SQL
-
in my database Table i have a column name BookDate(nvarchar) 22/03/2013 01:25 PM stored data in this format now i need to match only with date out of date time it should be matched with current date please help with a query Thanking you
-
in my database Table i have a column name BookDate(nvarchar) 22/03/2013 01:25 PM stored data in this format now i need to match only with date out of date time it should be matched with current date please help with a query Thanking you
nukalarajesh wrote:
BookDate(nvarchar)
Don't store dates as strings. Change the column to
datetime
(ordatetime2(0)
if you're using SQL 2008 or higher), and then query forBookDate >= @Today And BookDate < @Tomorrow
.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
in my database Table i have a column name BookDate(nvarchar) 22/03/2013 01:25 PM stored data in this format now i need to match only with date out of date time it should be matched with current date please help with a query Thanking you
If you are wondering why your other post was removed (in less than 10 minutes!), it was because of the "urgency". We're volunteers, answering questions in our spare time. Had you included it with your question, then the question would have been gone too. If you want an answer "fast", then you better make sure that there's a clear problem description, and some example-code showing what you tried to achieve. You might also want to include a subject-line that's a bit more descriptive; posts in the database-forum usually have some SQL, and it doesn't give a clue of what you're doing.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
-
in my database Table i have a column name BookDate(nvarchar) 22/03/2013 01:25 PM stored data in this format now i need to match only with date out of date time it should be matched with current date please help with a query Thanking you
Just in case you did not take Richard seriously - DO NOT STORE DATES AS TEXT, USE THE DATETIME DATATYPE. This is the basis of your problem. How do I make that red, can I make it flash, can I make it jump through the monitor and thump it into the desk?
Never underestimate the power of human stupidity RAH
-
in my database Table i have a column name BookDate(nvarchar) 22/03/2013 01:25 PM stored data in this format now i need to match only with date out of date time it should be matched with current date please help with a query Thanking you
use trunc(your_field name)= trunc(sysdate) or sysdate-1 for yesterday. or trunc(field_name)='12-apr-2012'