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 2000 Forums
 Transact-SQL (2000)
 declaring variables

Author  Topic 

jamie
Aged Yak Warrior

542 Posts

Posted - 2004-03-17 : 06:04:10
hello,
I am tryin to write a sql script and have stumbled on some problems.
:
how can I do something like this :

declare
@date datetime
@date = '2003-01-01 00:00:00'
select * from table where datein > @date


?
thanks for any info,
Jamie

Frank Kalis
Constraint Violating Yak Guru

413 Posts

Posted - 2004-03-17 : 06:08:37
Is this a typo?

set @date = '2003-01-01 00:00:00'


--Frank
http://www.insidesql.de
Go to Top of Page

smousumi
Starting Member

19 Posts

Posted - 2004-03-17 : 07:07:56
Try like this....

declare @date datetime
set @date = '2003-01-01 00:00:00'
select * from table where datein > @date




mousumi
Go to Top of Page

jamie
Aged Yak Warrior

542 Posts

Posted - 2004-03-17 : 08:28:34
nice one, forgot the word SET !!
thank you.
Go to Top of Page
   

- Advertisement -