Concatenation Error in query in sqlserver

Posted by Klbaiju under ASP.NET on 7/2/2014 | Points: 10 | Views : 910 | Status : [Member] | Replies : 1
Hi below code shows error while concatening

string tour_Date = Convert.ToDateTime(tourdate).ToString("yyyy-MM-dd");

strCmd = @"create table #temp(dtime datetime)
declare @i int = 0, @date datetime ='"+tour_Date+"'
while @i < 4
begin
insert into #temp ([dtime]) values (dateadd(dd,@i,@date))
set @i = @i + 1
end

my requirement is i want to concatenate tour_Date with datetime

ie @date datetime ='"+tour_Date+"'.

i have tried @date datetime =+'&tour_Date&'+,

@date datetime ='+tour_Date+'. every thing shows error

how to solve this

Regards

Baiju

drop table #temp";




Responses

Posted by: Bandi on: 7/2/2014 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Could you please post the error message ?

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response