Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- USE [Aardwolf]
- GO
- /****** Object: StoredProcedure [dbo].[map_getportal_new] Script Date: 03/15/2013 20:16:48 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[map_getportal_new]
- (
- @user nvarchar(16)
- ,@eploc nvarchar(64)
- )
- AS
- BEGIN
- SET NOCOUNT ON;
- DECLARE @ReturnCode int
- ,@ErrorCode int
- ,@RowCount int
- ,@InTrans tinyint
- ,@Message nvarchar(200)
- SELECT @ReturnCode = 0
- ,@ErrorCode = 0
- ,@RowCount = 0
- ,@InTrans = 0
- ,@Message = N'map_getportal_new: '
- DECLARE @count int
- ,@sql nvarchar(max)
- ,@param nvarchar(64) = '@eploc nvarchar(128)'
- ,@table nvarchar(128) = '[Aardwolf].[dbo].[Portals ' + @user + ' New]';
- EXEC @count = [Aardwolf].[dbo].[cd_is_user] @user;
- IF (@count != 1)
- BEGIN
- SET @ReturnCode = -5
- SET @Message = @Message + N'one user with that name not found';
- GOTO ProcError
- END
- SET @sql = N'SELECT * FROM ' + @table + ' WHERE [EntryPoint] = @eploc;';
- EXEC sp_executesql @sql, @param, @eploc;
- SET @ReturnCode = @@ERROR;
- ProcExit:
- SET NOCOUNT OFF;
- RETURN(@ReturnCode)
- ProcError:
- RAISERROR(@Message,16,1)
- GOTO ProcExit
- END
- GO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement