Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003
    Posts
    1

    Unanswered: Create View using Stored procedure

    I would like to drop and re-create a view using stored procedure. I try with the following codes for creating view. but some its not working.
    How can I drop the existing view befor creating it?

    Declare @sql_command nvarchar(4000)
    Declare @ParmDef nvarchar(4000)
    Declare @Branch int

    Set @sql_command =N'Create view [vwacchart] as ( Select * from ah where ah1=' + @Pamvar + ')'
    set @parmdef =N'@Pamvar int'
    set @branch=1

    EXEC sp_executesql @sql_command,@parmdef,@Pamvar= @branch
    Last edited by bijujoy123; 12-01-03 at 13:56.

  2. #2
    Join Date
    Nov 2003
    Posts
    94
    N'Create view [vwacchart] as ( Select * from ah where ah1=' + @Pamvar + ')'

    Or something like it. The text as shown in your post will not substitute in the @variable, but be parsed as meaning =@variable.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •