Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- USE [RM498_TESTBENCH]
- GO
- /****** Objet : UserDefinedFunction [dbo].[GetPhaseParams] Date de génération du script : 06/05/2010 12:24:43 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- -- Author: <Author,,Name>
- -- Create date: <Create Date, ,>
- -- Description: <Description, ,>
- -- =============================================
- CREATE FUNCTION [dbo].[GetPhaseParams]
- -- Add the parameters for the function here
- (
- @RefExecution int
- )
- RETURNS nvarchar(1000)
- AS
- BEGIN
- -- Declare the return variable here
- declare @Result nvarchar(1000)
- declare @Name nvarchar(1000)
- declare @StringValue nvarchar(1000)
- declare @FloatValue float
- declare @BoolValue bit
- declare CrsParams cursor fast_forward for
- select [Name] as N , StringValue, BoolValue, FloatValue
- from PhaseParameter
- where Execution = @RefExecution
- order by N
- set @Result = ''
- open CrsParams
- fetch next from CrsParams into @Name, @StringValue, @BoolValue,@FloatValue
- while (@@FETCH_STATUS <> -1)
- begin
- set @Result = @Result + ' ' + @Name + ':'
- if not @StringValue is null
- begin
- set @Result = @Result + @StringValue
- end
- if not @FloatValue is null
- begin
- set @Result = @Result + cast (@FloatValue as nvarchar(17))
- end
- if not @BoolValue is null
- begin
- if @BoolValue = 0
- set @Result = @Result + 'FALSE'
- else
- set @Result = @Result + 'TRUE'
- end
- set @Result = @Result + ' '
- fetch next from CrsParams into @Name, @StringValue, @BoolValue,@FloatValue
- end
- close CrsParams
- deallocate CrsParams
- -- Return the result of the function
- RETURN @Result
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement