all groups > sql server dts > october 2005 >
You're in the

sql server dts

group:

SQL code to select data for TODAY


SQL code to select data for TODAY Stan
10/27/2005 2:39:05 PM
sql server dts: I am trying to code a DTS export package to select records from a table where
the significant date field is a CHAR length of 8 variable. The values are
like '20051027'. I want to code a SQL statement to select all records for the
current (system) date.
--
RE: SQL code to select data for TODAY SQL
10/28/2005 1:40:05 AM
select * from table where field = convert(char,getdate(),112)

http://sqlservercode.blogspot.com/

[quoted text, click to view]
RE: SQL code to select data for TODAY Allan Mitchell
10/29/2005 2:55:44 AM
Hello SQL,


I would probably use a slight variation of this

select * from table where field = convert(char(8),getdate(),112)

The reason being that the length of the "unlengthed" is 30

select DATALENGTH(convert(char,getdate(),112))



Allan



[quoted text, click to view]

AddThis Social Bookmark Button