- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
ALTER PROCEDURE [dbo].[SomeProc]
(
@TableName Varchar(500),
@Condition Varchar(1000)
)
--================================================================
-- Stored procedure: SomeProc
-- Description: Returns rows depending on a dynamic condition
--
-- Inputs:
--
-- Returns:
-- Recordset 1: UserID, Name
--
--================================================================
AS
BEGIN
DECLARE @StrQuery varchar(1000)
If charindex('[Tablename]',@tablename) > 0
begin
print 'new'
SET @StrQuery = 'Select * From ' + @TableName + ' Where ' + @Condition
print @tablename
print @condition
print @strquery
end
else
SET @StrQuery = 'Select * From ' + @TableName + ' Where ' + @Condition + ' And [Tablename] = 1'
Exec(@StrQuery)
END
Комментарии (0) RSS
Добавить комментарий