Create Procedure EGA_DRUGREG_CHECKVERIFA_DRUGREG_CHECKVERIFYCODE (@Verifycode nvarchar (50), - check code @Type nvarchar (10) - Table type, see Case block @rid nvarchar (128) Output - If there is the same check code, output ID, Otherwise '') AS
Set @ rid = '' declare @sql nvarchar (256) IF convert (int, @ type)> 4 and communication (int, @Type) <0 return set @SQL = 'SELECT' @ rid '= id from' set @SQL = @SQL CASE @Type when '0' Ten 'Table0' When '1' Ten 'table1' When '2' TABLE2 'WHEN' 3 'TEN' TABLE3 'WHEN' 4 'THEN' TABLE4 'END Set @SQL = @SQL 'Where f_verifycode =' '' @Verifycode '' 'EXEC (@SQL)
--exec sp_executesql (@SQL, N '@ rid nvarchar (128)', @ RID = ''
SELECT @RID
Returngo