christer99
IS-IT--Management
- Dec 3, 2001
- 247
Getting Syntax error converting datetime from character string when doing: SET @SQL=' CONVERT(DateTime,"'+@v_excldate +'") AS DD'
@v_excldate is set to 2006-01-01 00:00:00.000
full code below. Appreciate any help.
declare @SQL VARCHAR(8000)
DECLARE @v_excldate DATETIME
set @v_excldate= (SELECT DATECUT FROM dbo.ProspImportConf)
if (isdate(@v_excldate)=0) set @v_excldate='1900-01-01'
SELECT @v_excldate
SET @SQL=' CONVERT(DateTime,"'+@v_excldate +'") AS DD'
SELECT @SQL
@v_excldate is set to 2006-01-01 00:00:00.000
full code below. Appreciate any help.
declare @SQL VARCHAR(8000)
DECLARE @v_excldate DATETIME
set @v_excldate= (SELECT DATECUT FROM dbo.ProspImportConf)
if (isdate(@v_excldate)=0) set @v_excldate='1900-01-01'
SELECT @v_excldate
SET @SQL=' CONVERT(DateTime,"'+@v_excldate +'") AS DD'
SELECT @SQL