Posts

Showing posts with the label Maximum stored procedure

Insert Unique Value in MS SQL Database By Using SQL Stored Procedure

Image
When we enter some data in database then its repetition is major problem for at all. Here I am using a table with Mobile No. as primary key and trying to insert unique value to it. You can see database in this image.   Stored procedure wants phone no as a parameter which can be passed easily create procedure insert_unique ( @phone numeric(10,0) ) as begin INSERT INTO PhoneData(Phoneno)     SELECT @phone WHERE NOT EXISTS ( SELECT phoneno FROM PhoneData WHERE Phoneno = @phone) end Pass your phone no in this procedure and it will insert only unique record.

Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32)

When you execute your procedure in your database then a very common error of MSSQL " Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32). " comes often. Solution to this problem is when you execute your procedure then then use keyword 'Go' between final 'end' and exec procedure Like ALTER procedure [dbo].[test] ( @a nvarchar(50), @b nvarchar(50) ) as  declare @id int  declare @Aid2 int   declare @counter int     begin                     select 1       end     go   exec test 'starplus','starplus7' This will solve your problem.......