dbTalk Databases Forums  

SQL Query from Access to SQL Server

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss SQL Query from Access to SQL Server in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
rune@totalweb.no
 
Posts: n/a

Default SQL Query from Access to SQL Server - 09-25-2007 , 05:00 AM






Hi

I'm trying to convert an SQL Query from Access to SQL Server. The
Access Query goes like this:

SELECT Format(EntryDate, 'ddd mm dd') AS [Day]
FROM JournalEntries

This query returns the name of the day followed by month and date (Su
aug 21)

What would this be like in SQL Server ? What style id do I have to use
to get the correct format ?


Regards
Rune


Reply With Quote
  #2  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: SQL Query from Access to SQL Server - 09-25-2007 , 04:00 PM






(rune (AT) totalweb (DOT) no) writes:
Quote:
I'm trying to convert an SQL Query from Access to SQL Server. The
Access Query goes like this:

SELECT Format(EntryDate, 'ddd mm dd') AS [Day]
FROM JournalEntries

This query returns the name of the day followed by month and date (Su
aug 21)

What would this be like in SQL Server ? What style id do I have to use
to get the correct format ?
select convert(varchar(11), EntryDate)

For more options on date formatting, look up the topic on Cast and Convert
in Books Online.

The best is to return the date a datetime value to the client, and let
the client do the formatting.


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.