SQLTeam.com | Weblogs | Forums

SQL string into SQL query


#1

Hi All,
Am having SQL string

DECLARE @dtReportDateStart SMALLDATETIME = DATEADD(MONTH, DATEDIFF(MONTH, 0, @dtReportDateEnd), 0)

i want it to convert (concatenate) sql query. . Anyone suggest please how i do this.

Regards,
M.Anitha


#2

What do you mean by convert sql query? Do you have a query that you want to add the @dtReportDateStart into or just use the variable?


#3

Thanks for your Repli,
Just use the variable i have to convert it into Concatenate syntax.


#4

Maybe the O/P wants some dynamic SQL including the @dtReportDate value?

if so I would use a parametrised query with sp_ExecuteSQL for that