Results 1 to 2 of 2

Thread: Create View

  1. #1
    Balbir Singh Guest

    Create View

    When I use following command it works fine.

    CREATE VIEW dbo.[ikw_custom]
    AS
    SELECT * FROM rns_keyword.dbo.ikw_custom

    but if I use following command with condition it gives me an error.

    if not exists(select * from sysobjects where name ='ikw_custom' and type='V&#39
    begin
    CREATE VIEW dbo.[ikw_custom]
    AS
    SELECT * FROM rns_keyword.dbo.ikw_custom
    end

    help will be appriciated.
    Thanks in advance
    -Balbir

  2. #2
    Simon Guest

    Create View (reply)

    Balbir

    The create view must be the first statement in a batch.

    A way around the problem is to use
    exec ("create view ...&#34



    ------------
    Balbir Singh at 1/8/01 7:44:31 PM

    When I use following command it works fine.

    CREATE VIEW dbo.[ikw_custom]
    AS
    SELECT * FROM rns_keyword.dbo.ikw_custom

    but if I use following command with condition it gives me an error.

    if not exists(select * from sysobjects where name ='ikw_custom' and type='V&#39
    begin
    CREATE VIEW dbo.[ikw_custom]
    AS
    SELECT * FROM rns_keyword.dbo.ikw_custom
    end

    help will be appriciated.
    Thanks in advance
    -Balbir

Posting Permissions

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