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
 SQL Server Development (2000)
 Dynamic SQL

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-08-01 : 10:00:28
Joseph writes "Dynamic SQL is excellent. But, I have never bneen abloe to build a string which includes a dynamin date, ie:

DECLARE @Qry varchar(2000)
SET @Qry = 'SELECT * From Orders WHERE Order_Dt > ' + '6/1/01'
EXEC(@Qry)

I can never get the date properly added to the string. I tried many things like:

SET @Qry = 'SELECT * From Orders WHERE Order_Dt > ''' + '6/1/01' + ''' etc.

Using:
SQL Server 2000
Windows 2000

Joseph Lucier"
   

- Advertisement -