Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 dependant value

Author  Topic 

dbonneau
Yak Posting Veteran

50 Posts

Posted - 2009-03-11 : 14:21:24
Hi, Is there a logic to change date in one place so I don't have to change date in all the queries.
Thank you so much !

select count(*) from A where date = '03/10/2009'
select count(*) from B where date = '03/10/2009'
select count(*) from B where date = '03/10/2009'
select count(*) from D where date = '03/10/2009'
select count(*) from C where date = '03/10/2009'



vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2009-03-11 : 14:42:56
Delcare a variable amnd use it..

DECLARE @FROM_DATE CHAR(8)
SELECT @FROM_DATE = '03/10/2009'

and then use in all queries.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-03-12 : 02:33:31

or make it as procedure that accepts date and use that date in the queries

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -