I belive the problem will be that the datepart attribute of DateAdd is not a
string. If you did the following it would probably work.
DECLARE @DatePart varchar(10)
SELECT @DatePart = 'dd'
DECLARE @TmpSQL varchar(200)
SET @TmpSQL ='DateAdd('+@DatePart+', 5, GetDate())'
EXEC(@TmpSQL)
This is probably not the best method but will I think work.
-----Original Message-----
From: Bernd VanSkiver [mailto:[EMAIL PROTECTED]]
Sent: 05 December 2001 15:24
To: SQL
Subject: SQL Query Builder & Date function problem
Does anyone know if Microsoft SQL 2000 has a query builder similar to the
query builder in ColdFusion? I think I remember running in to it once
before, but I cannot find it again. It seems like the query builder in SQL
was more advanced than ColdFusion's as well.
Also, is there a way to use a SQL variable in a Date function? Below is an
example of what I am trying to do:
DECLARE @DatePart varchar(10)
SELECT @DatePart = 'dd'
SELECT DateAdd(@DatePart, 5, GetDate())
When I run this I get the following error message: "Invalid parameter 1
specified for dateadd."
Bernd VanSkiver
[EMAIL PROTECTED]
ColdFusion Developer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community. http://www.fusionauthority.com/ads.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists