Results 1 to 4 of 4

Thread: Run (execute) a .sql Script - Sql Server 7.0

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    NY, USA.
    Posts
    240

    Question

    Hi,
    I have SQL Server 7.0 (Desktop Edt.) installed on my system. Is it possible for me to execute a .sql script that I have previously created without using the program "Query Analyzer". Can this be do in VB 6.

    Thanks
    Omar
    [email protected]
    http://omar.caribwalk.com
    To God Be The Glory

    I see Tech People ...

  2. #2
    Addicted Member AngelinaM's Avatar
    Join Date
    Jan 2001
    Location
    Tampa, Florida
    Posts
    175

    You can do something like this...

    Set cnn = New ADODB.Connection
    Set rs = New ADODB.Recordset

    cnn.Open "driver={SQL Server};server=NICE-GBEFXJTDN4;uid=sa;pwd=;database=z_AngelaClassTester"

    rs.Open "Select * from MethodParameters where SubClassName = '" & ClassTestUtil.cmbSubClass.Text & "' and MethodName = '" & ClassTestUtil.cmbMethod.Text & "'" & " Order by ParameterOrder", cnn, adOpenKeyset, adLockOptimistic

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    NY, USA.
    Posts
    240

    Thumbs up Thanks I will try it now

    Thanks I will try it now
    Omar
    [email protected]
    http://omar.caribwalk.com
    To God Be The Glory

    I see Tech People ...

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    NY, USA.
    Posts
    240

    How hould I use this

    Hi,
    What should I put in place of ClassTestUtil.cmbMethod.Text and ClassTestUtil.cmbSubClass.Text. I don't understand how I should use this.

    the .sql script that I'm trying to run/execut has the following code.


    Code:
    /****** Object:  Table [dbo].[links]    Script Date: 2/3/01 8:26:37 AM ******/
    if exists (select * from sysobjects where id = object_id(N'[dbo].[links]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    drop table [dbo].[links]
    GO
    
    /****** Object:  Table [dbo].[listings]    Script Date: 2/3/01 8:26:37 AM ******/
    if exists (select * from sysobjects where id = object_id(N'[dbo].[listings]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    drop table [dbo].[listings]
    GO
    
    /****** Object:  Table [dbo].[users]    Script Date: 2/3/01 8:26:37 AM ******/
    if exists (select * from sysobjects where id = object_id(N'[dbo].[users]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    drop table [dbo].[users]
    GO
    
    /****** Object:  Table [dbo].[links]    Script Date: 2/3/01 8:26:42 AM ******/
    CREATE TABLE [dbo].[links] (
    	[link_id] [numeric](18, 0) IDENTITY (1, 1) NOT NULL ,
    	[link_user_id] [numeric](18, 0) NOT NULL ,
    	[link_title] [varchar] (50) NOT NULL ,
    	[link_url] [varchar] (50) NOT NULL ,
    	[link_dated_added] [datetime] NOT NULL 
    ) ON [PRIMARY]
    GO
    
    /****** Object:  Table [dbo].[listings]    Script Date: 2/3/01 8:26:47 AM ******/
    CREATE TABLE [dbo].[listings] (
    	[listing_id] [numeric](18, 0) IDENTITY (1, 1) NOT NULL ,
    	[listing_user_id] [numeric](18, 0) NULL ,
    	[listing_shared] [bit] NOT NULL ,
    	[listing_date_posted] [datetime] NOT NULL 
    ) ON [PRIMARY]
    GO
    
    /****** Object:  Table [dbo].[users]    Script Date: 2/3/01 8:26:49 AM ******/
    CREATE TABLE [dbo].[users] (
    	[user_id] [numeric](18, 0) IDENTITY (1, 1) NOT NULL ,
    	[user_loginname] [varchar] (25) NULL ,
    	[user_password] [varchar] (25) NULL ,
    	[user_fullname] [varchar] (50) NULL ,
    	[user_company] [varchar] (50) NULL ,
    	[user_phone] [varchar] (50) NOT NULL ,
    	[user_email] [varchar] (50) NULL ,
    	[user_url] [varchar] (50) NULL ,
    	[user_profile] [text] NULL ,
    	[user_date_added] [datetime] NULL ,
    	[user_type_id] [int] NULL ,
    	[user_enabled] [bit] NULL 
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    GO
    
    ALTER TABLE [dbo].[links] WITH NOCHECK ADD 
    	CONSTRAINT [DF_links_link_title] DEFAULT ('') FOR [link_title],
    	CONSTRAINT [DF_links_link_url] DEFAULT ('') FOR [link_url],
    	CONSTRAINT [DF_links_link_dated_added] DEFAULT (getdate()) FOR [link_dated_added]
    GO
    
    ALTER TABLE [dbo].[listings] WITH NOCHECK ADD 
    	CONSTRAINT [DF_listings_listing_shared] DEFAULT (0) FOR [listing_shared],
    	CONSTRAINT [DF_listings_listing_date_posted] DEFAULT (getdate()) FOR [listing_date_posted]
    GO
    
    ALTER TABLE [dbo].[users] WITH NOCHECK ADD 
    	CONSTRAINT [DF_users_user_loginname] DEFAULT ('') FOR [user_loginname],
    	CONSTRAINT [DF_users_user_password] DEFAULT ('') FOR [user_password],
    	CONSTRAINT [DF_users_user_fullname] DEFAULT ('') FOR [user_fullname],
    	CONSTRAINT [DF_users_user_company] DEFAULT ('') FOR [user_company],
    	CONSTRAINT [DF_users] DEFAULT ('UNKNOWN') FOR [user_phone],
    	CONSTRAINT [DF_users_user_email] DEFAULT ('') FOR [user_email],
    	CONSTRAINT [DF_users_user_url] DEFAULT ('') FOR [user_url],
    	CONSTRAINT [DF_users_user_profile] DEFAULT ('') FOR [user_profile],
    	CONSTRAINT [DF_users_user_date_added] DEFAULT (getdate()) FOR [user_date_added],
    	CONSTRAINT [DF_users_user_enabled] DEFAULT (1) FOR [user_enabled]
    GO
    
    GRANT  REFERENCES ,  SELECT ,  INSERT ,  DELETE ,  UPDATE  ON [dbo].[links]  TO [omar]
    GO
    
    GRANT  REFERENCES ,  SELECT ,  INSERT ,  DELETE ,  UPDATE  ON [dbo].[listings]  TO [omar]
    GO
    
    GRANT  REFERENCES ,  SELECT ,  INSERT ,  DELETE ,  UPDATE  ON [dbo].[users]  TO [omar]
    GO
    Omar
    [email protected]
    http://omar.caribwalk.com
    To God Be The Glory

    I see Tech People ...

Posting Permissions

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



Click Here to Expand Forum to Full Width