473,399 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

what is equivalent of format(date) function of MS Access in MS Sql Server 2000

Hi All,
I am facing a problem with a sql what i used in MS Access but its not
returning the same result in MS Sql Server 2000. Here i am giving the
sql:

SELECT TOP 3 format( MY_DATE, "dddd mm, yyyy" ) FROM MY_TAB WHERE
MY_ID=1

The above sql in ACCESS return me the date in below format in one
column:

Friday 09, 2003

But in Sql server 2000 i am not getting the same format eventhough i
am using convert function, date part function etc.

Please if you find the solution would be helpful for me..

Thanks
Hoque
Jul 20 '05 #1
3 34882
Hi

If you field is a datetime, you can use the CONVERT function to convert it
to a formatted string. See books online for more information.

John

"Leader" <so******@yahoo.com> wrote in message
news:b1**************************@posting.google.c om...
Hi All,
I am facing a problem with a sql what i used in MS Access but its not
returning the same result in MS Sql Server 2000. Here i am giving the
sql:

SELECT TOP 3 format( MY_DATE, "dddd mm, yyyy" ) FROM MY_TAB WHERE
MY_ID=1

The above sql in ACCESS return me the date in below format in one
column:

Friday 09, 2003

But in Sql server 2000 i am not getting the same format eventhough i
am using convert function, date part function etc.

Please if you find the solution would be helpful for me..

Thanks
Hoque

Jul 20 '05 #2
Leader (so******@yahoo.com) writes:
I am facing a problem with a sql what i used in MS Access but its not
returning the same result in MS Sql Server 2000. Here i am giving the
sql:

SELECT TOP 3 format( MY_DATE, "dddd mm, yyyy" ) FROM MY_TAB WHERE
MY_ID=1

The above sql in ACCESS return me the date in below format in one
column:

Friday 09, 2003

But in Sql server 2000 i am not getting the same format eventhough i
am using convert function, date part function etc.


This gives you what you want:

select datename(dw, getdate()) + ' ' + datename(dd, getdate()) + ', ' +
datename(yyyy, getdate())

Well almost. You don't get any leading zero for a one-digit date.

--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #3
I am not certain about the type, but something like
CONVERT(varchar,MY_DATE,112) should work....

The 112 part may be incorrect, look up CONVERT in the Query Analyzer
help file... It shows the format numbers.

On Tue, 22 Jul 2003 21:42:55 +0000 (UTC), Erland Sommarskog
<so****@algonet.se> wrote:
Leader (so******@yahoo.com) writes:
I am facing a problem with a sql what i used in MS Access but its not
returning the same result in MS Sql Server 2000. Here i am giving the
sql:

SELECT TOP 3 format( MY_DATE, "dddd mm, yyyy" ) FROM MY_TAB WHERE
MY_ID=1

The above sql in ACCESS return me the date in below format in one
column:

Friday 09, 2003

But in Sql server 2000 i am not getting the same format eventhough i
am using convert function, date part function etc.


This gives you what you want:

select datename(dw, getdate()) + ' ' + datename(dd, getdate()) + ', ' +
datename(yyyy, getdate())

Well almost. You don't get any leading zero for a one-digit date.


Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Andreas Lauffer | last post by:
I changed from Access97 to AccessXP and I have immense performance problems. Details: - Access XP MDB with Jet 4.0 ( no ADP-Project ) - Linked Tables to SQL-Server 2000 over ODBC I used...
1
by: Jatin | last post by:
Hi, I have developed an application using VB 6 (SP 5), MS Access 2000 and Crystal Reports 9. I migrated from from access to SQl Server 2000. This wasn't a problem as i could import all the...
48
by: ik | last post by:
ERROR after uninstalling SQL Server 2005 Express I get this message, SQLDMO has not been registered. Please re-run your setupand contact your system administrator. GREAT!!! ReInstalled SQL...
1
by: Keith Chadwick | last post by:
Been trying to use the ms:format-date() in one of my transformations. I have all of the necessary declarations in my xml as in <?xml version="1.0" ?> <data xml:space="default"...
8
by: William Bradley | last post by:
First of all I have been working with Access 97 and this morning the owner of the business phoned me to inform me that he had updated to Access 2000 and parts of my forms would not work anymore. ...
6
by: Willie wjb | last post by:
Hi, i have a client program that sends a filter expression to the server PC. On that server PC this filter is put over a datatable and the result is send back. the server can be located on a...
2
by: saiprasanthi | last post by:
Hi, Can you please tell what is the procedure in SQL Server 2000 to automatically send an email to the customer. I know that we can do it in DTS Packages. But what should be the code in the...
6
by: Grey Alien | last post by:
I have an ASP.Net website that was developed using SQL Server 2000. I want to 'port' it to use SQL Server Express, since I don't have SQL Server 2000 (besides my db is less than 1GB). Questions:...
9
by: kathnicole | last post by:
hi there, I have a field called DateEnacted (data type :date/time) could anyone tell me how can i change the format to dd/mm/yyyy , when i enter values in the table, instead of mm/dd/yyyy? ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.