Hi,
I want to create a temporary table and store the logdetails from
a.logdetail column.
select a.logdetail , b.shmacno
case when b.shmacno is null then
select
cast(substring( a.logdetail,1,c harindex('·',a. logdetail)-1) as
char(2)) as ShmCoy,
cast(substring( a.logdetail,cha rindex('·',a.lo gdetail)+1,char index('·',a.log detail,charinde x('·',a.logdeta il)+1)-(charindex('·', a.logdetail)+1) )
as char(10)) as ShmAcno
into ##tblabc
end
from shractivitylog a
left outer join
shrsharemaster b
on a.logkey = b.shmrecid
This statement giving me syntax error. Please help me..
Server: Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'case'.
Server: Msg 156, Level 15, State 1, Line 7
Incorrect syntax near the keyword 'end'.
sample data in a.logdetail
BR··Light Blue Duck··Toon Town Central·Silly Street···02 Sep
2003·1·SGL·SGL· ·01 Jan 1900·0·0·0·0·0. 00·····
·0234578······· ····· ··········
UB··Aqua Duck··Toon Town Central·Punchli ne Place···02 Sep
2003·1·SGL·SGL· ·01 Jan 1900·0·0·0·0·0. 00·····
Regards.
I want to create a temporary table and store the logdetails from
a.logdetail column.
select a.logdetail , b.shmacno
case when b.shmacno is null then
select
cast(substring( a.logdetail,1,c harindex('·',a. logdetail)-1) as
char(2)) as ShmCoy,
cast(substring( a.logdetail,cha rindex('·',a.lo gdetail)+1,char index('·',a.log detail,charinde x('·',a.logdeta il)+1)-(charindex('·', a.logdetail)+1) )
as char(10)) as ShmAcno
into ##tblabc
end
from shractivitylog a
left outer join
shrsharemaster b
on a.logkey = b.shmrecid
This statement giving me syntax error. Please help me..
Server: Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'case'.
Server: Msg 156, Level 15, State 1, Line 7
Incorrect syntax near the keyword 'end'.
sample data in a.logdetail
BR··Light Blue Duck··Toon Town Central·Silly Street···02 Sep
2003·1·SGL·SGL· ·01 Jan 1900·0·0·0·0·0. 00·····
·0234578······· ····· ··········
UB··Aqua Duck··Toon Town Central·Punchli ne Place···02 Sep
2003·1·SGL·SGL· ·01 Jan 1900·0·0·0·0·0. 00·····
Regards.
Comment