From: Erland Sommarskog on 9 Aug 2010 15:52 LN (LN(a)discussions.microsoft.com) writes: > I am try to search for a date like 01/01/1900 but it does not. I found > this sp on web site and wonder if you can help debugging the probblem. > I try to run the sp to return all the columns and tables that have > 01/01/1900 values in the tables. Dates are not stored as strings in SQL Server but in an interal format. If you use something like datetimecol LIKE @searchstring the datetimecol will be converted to some default format. Which this format is you can find out by running SELECT convert(varchar, convert(datetime, '19000101')) Be careful to observe the double spacing. -- Erland Sommarskog, SQL Server MVP, esquel(a)sommarskog.se Links for SQL Server Books Online: SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
|
Pages: 1 Prev: impersonate SQL Server login Next: How to show chinese charaters? |