SQL Server Dates and Formatting

G

Guest

OK, this has bugged me for years now with SQL Server and Access. I have a
date field entered in SQL server and I am trying to do a query against it.
The format in SQL server is 'dd/MM/yyyy'. Do I really need to prepare my
query to follow this format or is there another way to query dates in
databases without knowing the format in the database?

Thanks
 
J

Jon Skeet [C# MVP]

Chuck said:
OK, this has bugged me for years now with SQL Server and Access. I have a
date field entered in SQL server and I am trying to do a query against it.
The format in SQL server is 'dd/MM/yyyy'. Do I really need to prepare my
query to follow this format or is there another way to query dates in
databases without knowing the format in the database?

Use parameters instead.

See http://www.pobox.com/~skeet/csharp/faq/#db.parameters
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top