Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Get default values of parameters in stored procedures


Get default values of parameters in stored procedures

Author
Message
Atif-ullah Sheikh
Atif-ullah Sheikh
Hall of Fame
Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)

Group: General Forum Members
Points: 3280 Visits: 5158
Comments posted to this topic are about the item Get default values of parameters in stored procedures

----------------------------------------------------------------------------------------------------------------------------------------------------------------------

Sometimes, winning is not an issue but trying.

You can check my BLOG here


Licentiat
Licentiat
SSC Rookie
SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)SSC Rookie (48 reputation)

Group: General Forum Members
Points: 48 Visits: 114
People may not know what is dbo.fnSplit that you use in this example...
Atif-ullah Sheikh
Atif-ullah Sheikh
Hall of Fame
Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)

Group: General Forum Members
Points: 3280 Visits: 5158
Here is the script of dbo.fnSplit function;


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE function [dbo].[fnSplit]
(@pString nvarchar(max),@pSplitChar char(1))
returns @tblTemp table (tid int,value varchar(1000))
as
begin
   declare @vStartPosition      int
   declare @vSplitPosition      int
   declare @vSplitValue      varchar(1000)
   declare @vCounter      int
   set @vCounter=1
   select @vStartPosition = 1,@vSplitPosition=0
   

   set @vSplitPosition = charindex( @pSplitChar , @pString , @vStartPosition )
   if (@vSplitPosition=0 and len(@pString) != 0)
   begin
      INSERT INTO @tblTemp
         (
         tid      ,
         value   
         Wink
      VALUES
         (
         1   ,
         @pString      
         Wink
      return      --------------------------------------------------------------->>
   end
   set @pString=@pString+@pSplitChar
   while (@vSplitPosition > 0 )
   begin
      set @vSplitValue = substring( @pString , @vStartPosition , @vSplitPosition - @vStartPosition )
      set @vSplitValue = ltrim(rtrim(@vSplitValue))
      INSERT INTO @tblTemp
         (
         tid      ,
         value   
         Wink
      VALUES
         (
         @vCounter   ,
         @vSplitValue      
         Wink
      set @vCounter=@vCounter+1
      set @vStartPosition = @vSplitPosition + 1
      set @vSplitPosition = charindex( @pSplitChar , @pString , @vStartPosition )
   end
   return
end




----------------------------------------------------------------------------------------------------------------------------------------------------------------------

Sometimes, winning is not an issue but trying.

You can check my BLOG here


Iwas Bornready
Iwas Bornready
SSCrazy Eights
SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)

Group: General Forum Members
Points: 8632 Visits: 885
Thanks for the script.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search