DateFormats from Access to SQL

Results 1 to 2 of 2

Thread: DateFormats from Access to SQL

  1. #1
    Mauricio Fuentes Guest

    Default DateFormats from Access to SQL

    Hello,<BR>Could you help me to code the follwing pieces of Access Querys into funtional MS SQL Server qrys? <BR><BR>Weekday([fecha],1) AS DiaSemana<BR><BR>Format([Inicio],"dd/mm/yyyy") AS StrFechaInicio, Format([Fin],"dd/mm/yyyy") AS StrFechaFin<BR><BR>Format$([inicio],"h:nn ampm") & " - " & Format$([fin],"h:nn ampm") AS Hora,<BR><BR>Count(tblGuestBook.GuestID) AS CuentaDeGuestID<BR><BR>Thanks in advance,<BR>Mauricio

  2. #2
    Join Date
    Dec 1969

    Default Maybe...

    I&#039;m not a SQL Server user, but it seems to me that the easiest ones to do are <BR>&nbsp; &nbsp; &nbsp; &nbsp; Format([Inicio],"dd/mm/yyyy") AS StrFechaInicio<BR>&nbsp; &nbsp; &nbsp; &nbsp; Format([Fin],"dd/mm/yyyy") AS StrFechaFin<BR><BR>because you can use CONVERT, as described at<BR><BR><BR><BR>It *LOOKS* like you could change<BR>&nbsp; &nbsp; &nbsp; &nbsp; Format([Inicio],"dd/mm/yyyy") AS StrFechaInicio<BR>into<BR>&nbsp; &nbsp; &nbsp; &nbsp; CONVERT(varchar, [Inicio],103) AS StrFechaInicio<BR><BR>***********<BR><BR>Also, it looks like<BR>&nbsp; &nbsp; Weekday([fecha],1) AS DiaSemana<BR>can be written as<BR>&nbsp; &nbsp; DatePart(dw,[fecha]) AS DiaSemana<BR><BR>See<BR><BR>**********<BR><BR>I don&#039;t see any direct way to do Format$([inicio],"h:nn ampm") <BR><BR>You might have to do that in your VBS code, instead.<BR><BR>Finally, I don&#039;t see any reason that COUNT would be any different.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts