Get default values of parameters in stored procedures

  • Atif-ullah Sheikh

    SSChampion

    Points: 12495

    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
    [font="Arial Black"]here[/font][/url][/right]

  • Licentiat

    SSC Enthusiast

    Points: 146

    People may not know what is dbo.fnSplit that you use in this example...

  • Atif-ullah Sheikh

    SSChampion

    Points: 12495

    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

    )

    VALUES

    (

    1 ,

    @pString

    )

    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

    )

    VALUES

    (

    @vCounter ,

    @vSplitValue

    )

    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
    [font="Arial Black"]here[/font][/url][/right]

  • akljfhnlaflkj

    SSC Guru

    Points: 76202

    Thanks for the script.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply