Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
| Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 24th, 2004, 09:42 AM
Authorized User
 
Join Date: Jan 2004
Location: , , .
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default creating tables using sql script -howto?

how can we create tables in sql server db using sql commands.. i mean where do i do that or type in from ...

this is part of an Unload of a Sybase 6.0.3 DB .. i need to paste & execute these so as to replicate the db creation ...


--------------------------------------------------------------------
% Usage: isql read C:\JOB COSTING\UNLOAD\RELOAD.SQL
%
% This command file reloads a database that was unloaded using "dbunload".
%
%

SET OPTION Statistics = 3;
SET OPTION Date_order = 'YMD';


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create userids and grant user permissions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

GRANT CONNECT TO "DBA" IDENTIFIED BY ENCRYPTED '\x68\x28\x92\x17\x45\xC4\x7D\xED\x78\x55\xEA\xD2\ xAC\xDF\x9F\x45\x47\x55\x71\x29\xFB\x7D\x95\xEA\x5 8\x06\x83\x8F\xB8\x33\xF8\xF4\xDB\x6B\x96\x85';
GRANT RESOURCE, DBA, SCHEDULE TO "DBA";
GRANT CONNECT TO "DBO";
GRANT GROUP TO "DBO";
GRANT RESOURCE, DBA TO "DBO";
GRANT CONNECT TO "aditya" IDENTIFIED BY ENCRYPTED '\xA0\x47\x3F\x4C\x4A\xF1\xD0\x13\xA8\xF5\x7E\x1B\ xE5\x06\xF2\x3E\xC4\x91\x8C\x4A\x09\x60\xC1\xC7\xE 7\xCB\xF7\x63\x02\x6B\x14\x45\x73\xE5\xB8\xE7';
COMMENT ON USER "aditya" IS '';
GRANT RESOURCE, DBA, REMOTE DBA TO "aditya";
GRANT CONNECT TO "abc" IDENTIFIED BY ENCRYPTED '\x5B\x4D\xC0\xED\xB6\x75\x21\x6F\xC6\xED\xDD\x32\ xA5\xB4\x01\x0B\x62\x5E\xB3\xC8\x15\xD8\xF0\xAA\x7 C\x82\xC9\x67\x50\xB7\x7D\x02\x6A\xC9\xEE\x9E';
COMMENT ON USER "abc" IS '';
GRANT RESOURCE, DBA, REMOTE DBA TO "abc";
GRANT CONNECT TO "kannan" IDENTIFIED BY ENCRYPTED '\x92\x70\x0F\x10\xDF\xFC\x1E\xA3\x44\xAB\x4C\x94\ xCD\x94\xC0\xE5\x8F\xD3\x57\x2E\x53\xE9\x23\x54\x1 7\x44\x6D\x07\xCD\xFB\x5F\x33\x1D\x42\xE8\xCE';
GRANT RESOURCE TO "kannan";
GRANT CONNECT TO "sandeep" IDENTIFIED BY ENCRYPTED '\x60\x71\xAE\xCC\x4B\xC7\x6A\x34\x45\x3C\x51\x82\ x18\x5C\x6E\x22\xD5\xC3\xCA\x35\x5F\x92\x9D\x08\xD 2\xA4\xDF\x0F\x4D\xF9\xB8\x1F\x60\x3C\x40\x5E';
GRANT RESOURCE TO "sandeep";
GRANT CONNECT TO "sethi" IDENTIFIED BY ENCRYPTED '\x68\x0A\x29\x5A\x31\x8E\xA0\x2C\x56\x07\xB4\x58\ x06\x9E\xF7\x58\xC9\xD6\xB0\x52\x0B\xEE\x18\xFF\x9 E\x60\xFD\x1B\x40\x85\xDC\x1F\xE0\xB6\xE3\x22';
GRANT RESOURCE TO "sethi";



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create user-defined types
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

commit work;


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create tables
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

GRANT MEMBERSHIP IN GROUP "SYS" TO "DBO";
CREATE TABLE "DBO"."RowGenerator"
(
    "row_num" smallint NOT NULL,
    PRIMARY KEY ("row_num")
);
CONNECT "DBA" IDENTIFIED BY "sql";
CONNECT "SYS";
GRANT INSERT ON "DBO"."RowGenerator" TO "SYS";
GRANT SELECT ON "DBO"."RowGenerator" TO "DBO";
GRANT SELECT ON "DBO"."RowGenerator" TO "PUBLIC";
CONNECT "DBA" IDENTIFIED BY "sql";
CREATE TABLE "DBA"."pbcattbl"
(
    "pbt_tnam" char(129) NOT NULL,
    "pbt_tid" integer NULL,
    "pbt_ownr" char(129) NOT NULL,
    "pbd_fhgt" smallint NULL,
    "pbd_fwgt" smallint NULL,
    "pbd_fitl" char(1) NULL,
    "pbd_funl" char(1) NULL,
    "pbd_fchr" smallint NULL,
    "pbd_fptc" smallint NULL,

);
GRANT SELECT, INSERT, DELETE, UPDATE, ALTER, REFERENCES ON "DBA"."pbcattbl" TO "PUBLIC";

CREATE TABLE "DBA"."messages"
(
    "msgid" char(40) NOT NULL,
    "msgtitle" char(255) NOT NULL,
    "msgtext" char(255) NOT NULL,
    "msgicon" char(12) NOT NULL,
    "msgbutton" char(17) NOT NULL,
    "msgdefaultbutton" integer NOT NULL,
    "msgseverity" integer NOT NULL,
    "msgprint" char(1) NOT NULL,
    "msguserinput" char(1) NOT NULL,
    PRIMARY KEY ("msgid")
);
CREATE TABLE "DBA"."company_master"
(
    "company_code" varchar(5) NOT NULL,
    "company_name" varchar(75) NULL,
    "location" varchar(25) NULL,
    "po_box" varchar(10) NULL,
    "city" varchar(20) NULL,
    "tel" varchar(20) NULL,
    "fax" varchar(20) NULL,
    "currency_code" varchar(3) NULL,
    "exchange_rate" numeric(8,4) NULL,
    "decimal_place" numeric(30,6) NULL,
    PRIMARY KEY ("company_code")
);
CREATE TABLE "DBA"."branches"
(
    "branch_id" varchar(8) NOT NULL,
    "branch_name" varchar(30) NOT NULL,
    "street" varchar(100) NULL,
    "city" varchar(25) NULL,
    "state" varchar(25) NULL,
    "country" varchar(25) NULL,
    "zip" varchar(10) NULL,
    "phone" varchar(15) NULL,
    "fax" varchar(15) NULL,
    "mobileno" varchar(15) NULL,
    "email" varchar(100) NULL,
    "inactive" varchar(1) NULL,
    "currency_code" varchar(3) NULL,
    "telex" varchar(25) NULL,
    "cr_no" varchar(25) NULL,
    "start_cr_no" integer NULL,
    "start_invoice_no" integer NULL,
    PRIMARY KEY ("branch_id")
);
CREATE TABLE "DBA"."suppliers"
(
    "supplier_id" varchar(8) NOT NULL,
    "supplier_name" varchar(30) NOT NULL,
    "contact_person" varchar(30) NULL,
    "street" varchar(100) NULL,
    "state" varchar(25) NULL,
    "city" varchar(25) NULL,
    "country" varchar(25) NULL,
    "zip" varchar(10) NULL,
    "phone" varchar(15) NULL,
    "fax" varchar(15) NULL,
    "email" varchar(100) NULL,
    "mobileno" varchar(15) NULL,
    "inactive" char(1) NULL,
    "supp_type" char(1) NULL,
    PRIMARY KEY ("supplier_id")
);





Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating an INSERT INTO SQL statement for 2 tables sburgess Access 1 April 18th, 2007 08:52 AM
Creating stored procedure with trigger (HOWTO ..) AzlanAziz SQL Language 0 January 16th, 2007 04:34 AM
Need help with Creating Procedures Script in SQL Rrotz BOOK: Professional DotNetNuke ASP.NET Portals ISBN: 0-7645-9563-6 0 November 1st, 2006 12:41 AM
howto convert sybase to sql server db qwjunk SQL Server DTS 0 August 14th, 2004 11:22 AM
Deleting Tables in SQL using ASP and VB Script sideshow245 Classic ASP Databases 1 February 2nd, 2004 07:38 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.