how to insert gridview data in sql server

Posted by Rajdotnet under Sql Server on 1/13/2012 | Points: 10 | Views : 1965 | Status : [Member] | Replies : 5
here i attach my sql query


i get following error
Msg 217, Level 16, State 1, Procedure Up_GridInsert, Line 22
Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32).

please any on solve that problem

sathiyaraj


Responses

Posted by: Susanthampy on: 1/24/2012 [Member] [MVP] Bronze | Points: 25
Posted by: Sksamantaray on: 1/24/2012 [Member] Silver | Points: 25

Up
0
Down
Are you using a cursor inside your procedure?
If you can add your code here, will be easy to solve?

Thanks,
Sanjay

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

Posted by: Rajdotnet on: 1/30/2012 [Member] Starter | Points: 25

Up
0
Down
I attach my source code here. please solve this problem sir.

thank you

sathiyaraj

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

Posted by: Rajdotnet on: 2/7/2012 [Member] Starter | Points: 25

Up
0
Down
ALTER procedure [dbo].[Up_GridInsert](@list varchar(max))

as
declare @spot SMALLINT,@st VARCHAR(8000),@sql VARCHAR(8000),@str VARCHAR(8000),@s int
BEGIN TRY
WHILE @list<> ' '
BEGIN
select * into #temp from Split_String(@list,'*')
set @list=(select list from #temp)
set @str=(select st from #temp)
set @sql = 'insert into gridemployee (EmployeeID,Employeename,Salary,Imagepath) values ('+convert(varchar(max),@str)+')'
--set @sql = 'insert into gridemployee values ('+convert(varchar(max),@str)+')'
print @sql
--exec(@sql)
drop table #temp
END
END TRY
BEGIN CATCH
set @s =0
END CATCH
select cast( msg_type as varchar )+'-'+ msg_e from res_msg where msg_id = @s

exec Up_GridInsert '1,sathi,50000,Water lilies.jpg*
2,karthi,30000,Blue hills.jpg*
3,rock,50000,ss.jpg*
4,dfdfd,5555,download.gif*
5,ramu,11111,rose.gif*
6,ramu,4000,2678359760_3c1db63d1a.jpg'


sathiyaraj

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

Posted by: Rajdotnet on: 2/7/2012 [Member] Starter | Points: 25

Up
0
Down
ALTER function [dbo].[Split_String](@stulist varchar(8000),@symbol char)

returns @split_tab table([st] [VARCHAR](8000) ,[list] [VARCHAR](8000))
as
begin
declare @spot SMALLINT, @str VARCHAR(8000)

SET @spot = CHARINDEX(@symbol, @stulist)
IF @spot>0
BEGIN
SET @str = CAST(LEFT(@stulist, @spot-1) AS varchar(500))
SET @stulist = RIGHT(@stulist, LEN(@stulist)-@spot)
END
ELSE
BEGIN
SET @str = CAST(@stulist AS varchar(500))
SET @stulist = ''
END
insert into @split_tab(st,list) values(@str,@stulist)
return
end


sathiyaraj

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

Login to post response