Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
adiboy0420
Starting Member
10 Posts |
Posted - 2012-07-16 : 21:02:51
|
hello everyone,i am new at creating tableand here is my codecreate function fn_retlatthree(@stg varchar (1000)returns @point table ( one varchar(1000), two varchar (1000), Three varhcar (1000))asbegin--1declare @x varchar(1000) declare @y varchar(1000) declare @z varchar(400) set @x= @stg while (CHARINDEX(',',@x)>0) begin--2 set @z=@y set @y=LEFT(@x,charindex(',',@x)-1) set @x=right(@x,len(@x)-len(@y)-1) end--2 select @z select @y select @x insert into @point values (@z,@y,@x)Return ()end--1----------- its giving me errorMsg 102, Level 15, State 1, Procedure fn_retlatthree, Line 5Incorrect syntax near 'returns'.Msg 137, Level 15, State 2, Procedure fn_retlatthree, Line 17Must declare the scalar variable "@stg".Msg 1087, Level 15, State 2, Procedure fn_retlatthree, Line 33Must declare the table variable "@point".can anyone please help me fix this syntex ?!?!? Please. !!!! |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-07-16 : 21:59:07
|
you dont need () at the endyou also have ) missing after parameter definitionanother issue is typo on varchar for three column------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
adiboy0420
Starting Member
10 Posts |
Posted - 2012-07-16 : 22:08:57
|
got it Thank you worked perfect, but i also had to take out select @zselect @yselect @xat the end of the code, |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-07-16 : 22:18:10
|
quote: Originally posted by adiboy0420 got it Thank you worked perfect, but i also had to take out select @zselect @yselect @xat the end of the code,
it wont cause any error but would simply echo results out------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|