dbTalk Databases Forums  

SQL code to select data for TODAY

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss SQL code to select data for TODAY in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Stan
 
Posts: n/a

Default SQL code to select data for TODAY - 10-27-2005 , 04:39 PM






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.
--
Stan Gosselin

Reply With Quote
  #2  
Old   
SQL
 
Posts: n/a

Default RE: SQL code to select data for TODAY - 10-28-2005 , 03:40 AM






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

http://sqlservercode.blogspot.com/

"Stan" wrote:

Quote:
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.
--
Stan Gosselin

Reply With Quote
  #3  
Old   
Allan Mitchell
 
Posts: n/a

Default RE: SQL code to select data for TODAY - 10-29-2005 , 04:55 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



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

http://sqlservercode.blogspot.com/

"Stan" wrote:

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.
--
Stan Gosselin



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.