The problem is:
An error is returned when an SQL statement is executed in batches.
Batch Processing is as follows:
Echo off creating database ....
Isql-Usa-Ppassword-S.-i1. SQL
Pause ..........
Isql-Usa-Ppassword-S.-iSQL. SQL
Pause ..........
Result:
C:/Documents and Settings/goping/My Documents/Library> echo off is creating a database ....
Off creating database ....
C:/Documents and Settings/goping/My Documents/Library> isql-Usa-Ppassword-S.-i1
. SQL
1> 2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14> 15> Msg 170, Level 15, State 1, S
Erver Wu Ge Ping, Line 1
Row 1st: There is a syntax error near.
C:/Documents and Settings/My Documents/Library> pause ..........
Press any key to continue...
C:/Documents and Settings/My Documents/Library> isql-Usa-Ppassword-S.-iS
QL. SQL
1> 2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14> 15> 16> 17> 18> 19> 20> 21> 22> 2
3> 24> 25> 26> 27> 28> 29> 30> 31> 32> 33> 34> 35> 36> 37> 38> 39> 40> 41> 42> 4
3> 44> 45> 46> 47> 48> 49> 50> 51> 52> 53> 54> 55> 56> 57> 58> 59> 60> 61> 62> 6
3> 64> 65> 66> 67> 68> 69> 70> 71> 72> 73> 74> 75> 76> 77> 78> 79> 80> 81> 82> 8
3> 84> 85> 86> 87> 88> 89> 90> 91> 92> 93> 94> 95> 96> 97> 98> 99> 100> 101> 102
> 103> 104> 105> 106> 107> 108> 109> 110> 111> 112> 113> 114> 115> 116
> 119> 120> 121> 122> 123> 124> 125> 126> 127> 128> 129> 130> 131> 132
> 135> 136> 137> 138> 139> 140> 141> 142> 143> 144> 145> 146> 147> 148
> 151> 152> 153> 154> 155> 156> 157> 158> 159> 160> 161> 162> 163> 164
> 167> 168> Msg 170, Level 15, State 1, Server Wu Ge Ping, Line 1
Row 1st: There is a syntax error near.
C:/Documents and Settings/My Documents/Library> pause ..........
Press any key to continue...
File: 1. SQL
Create database Library
ON
(NAME = Library_Data,
FILENAME = 'C:/Library_Data.MDF ',
SIZE = 2,
FILEGROWTH = 10%)
LOG ON
(NAME = Library_Log,
FILENAME = 'C:/Library_Log.LDF ',
SIZE = 1,
FILEGROWTH = 10%)
GO
File: SQL. SQL
Use [Library]
GO
If exists (select * from dbo. sysobjects where id = object_id (n' [dbo]. [Borrow_view] ') and OBJECTPROPERTY (id, n'isview') = 1)
Drop view [dbo]. [Borrow_view]
GO
If exists (select * from dbo. sysobjects where id = object_id (n' [dbo]. [Book_del] ') and OBJECTPROPERTY (id, n'isusertable') = 1)
Drop table [dbo]. [Book_del]
GO
If exists (select * from dbo. sysobjects where id = object_id (n' [dbo]. [Book_ifo] ') and OBJECTPROPERTY (id, n'isusertable') = 1)
Drop table [dbo]. [Book_ifo]
GO
If exists (select * from dbo. sysobjects where id = object_id (n' [dbo]. [Borrow_ifo] ') and OBJECTPROPERTY (id, n' isusertable') = 1)
Drop table [dbo]. [Borrow_ifo]
GO
If exists (select * from dbo. sysobjects where id = object_id (n' [dbo]. [Pwd_log] ') and OBJECTPROPERTY (id, n'isusertable') = 1)
Drop table [dbo]. [Pwd_log]
GO
If exists (select * from dbo. sysobjects where id = object_id (n' [dbo]. [Reader_del] ') and OBJECTPROPERTY (id, n'isusertable') = 1)
Drop table [dbo]. [Reader_del]
GO
If exists (select * from dbo. sysobjects where id = object_id (n' [dbo]. [Reader_ifo] ') and OBJECTPROPERTY (id, n' isusertable') = 1)
Drop table [dbo]. [Reader_ifo]
GO
If exists (select * from dbo. sysobjects where id = object_id (n' [dbo]. [Return_ifo] ') and OBJECTPROPERTY (id, n' isusertable') = 1)
Drop table [dbo]. [Return_ifo]
GO
If exists (select * from dbo. sysobjects where id = object_id (n' [dbo]. [Result] ') and OBJECTPROPERTY (id, n'isusertable') = 1)
Drop table [dbo]. [Result]
GO
Create table [dbo]. [Book_del] (
[Book_id_del] [varchar] (14) COLLATE Chinese_PRC_CI_AS not null,
[Book_name_del] [varchar] (20) COLLATE Chinese_PRC_CI_AS not null,
[Book_auther_del] [varchar] (10) COLLATE Chinese_PRC_CI_AS not null,
[Book_publish_del] [varchar] (20) COLLATE Chinese_PRC_CI_AS not null,
[Book_letters_del] [text] COLLATE Chinese_PRC_CI_AS not null,
[Book_count_del] [numeric] (2, 0) not null,
[Book_publish_time_del] [datetime] not null,
[Book_price_del] [float] not null,
[Book_type_del] [varchar] (20) COLLATE Chinese_PRC_CI_AS not null,
[Book_date_del] [datetime] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
Create table [dbo]. [Book_ifo] (
[Book_id] [varchar] (14) COLLATE Chinese_PRC_CI_AS not null,
[Book_name] [varchar] (20) COLLATE Chinese_PRC_CI_AS not null,
[Book_auther] [varchar] (10) COLLATE Chinese_PRC_CI_AS not null,
[Book_publish] [varchar] (20) COLLATE Chinese_PRC_CI_AS not null,
[Book_letters] [text] COLLATE Chinese_PRC_CI_AS NULL,
[Book_count] [int] NULL,
[Book_publish_time] [datetime] NULL,
[Book_price] [float] NULL,
[Book_type] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL,
[Book_Insert_Date] [datetime] not null,
[Book_index] [varchar] (10) COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
Create table [dbo]. [Borrow_ifo] (
[Borrow_reader_id] [varchar] (12) COLLATE Chinese_PRC_CI_AS not null,
[Borrow_book_id] [varchar] (14) COLLATE Chinese_PRC_CI_AS not null,
[Borrow_reader_name] [varchar] (20) COLLATE Chinese_PRC_CI_AS not null,
[Borrow_time] [datetime] NULL,
[Borrow_book_name] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL,
[Borrow_book_price] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL,
[Borrow_book_count] [int] NULL,
[Borrow_count_all] [int] NULL
) ON [PRIMARY]
GO
Create table [dbo]. [Pwd_log] (
[Log_name] [varchar] (20) COLLATE Chinese_PRC_CI_AS not null,
[Log_pwd] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY]
GO
Create table [dbo]. [Reader_del] (
[Reader_id_del] [varchar] (12) COLLATE Chinese_PRC_CI_AS not null,
[Reader_sfid_del] [varchar] (20) COLLATE Chinese_PRC_CI_AS not null,
[Reader_name_del] [varchar] (10) COLLATE Chinese_PRC_CI_AS not null,
[Reader_sex_del] [varchar] (4) COLLATE Chinese_PRC_CI_AS not null,
[Reader_spe_del] [varchar] (12) COLLATE Chinese_PRC_CI_AS not null,
[Reader_type_del] [varchar] (10) COLLATE Chinese_PRC_CI_AS NULL,
[Reader_max_count_del] [int] NULL,
[Reader_home_del] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL,
[Reader_phone_del] [varchar] (13) COLLATE Chinese_PRC_CI_AS NULL,
[Reader_money] [float] NULL,
[Reader_date_del] [datetime] NULL
) ON [PRIMARY]
GO
Create table [dbo]. [Reader_ifo] (
[Reader_id] [varchar] (12) COLLATE Chinese_PRC_CI_AS not null,
[Reader_sfid] [varchar] (20) COLLATE Chinese_PRC_CI_AS not null,
[Reader_name] [varchar] (10) COLLATE Chinese_PRC_CI_AS not null,
[Reader_sex] [varchar] (4) COLLATE Chinese_PRC_CI_AS not null,
[Reader_spe] [varchar] (12) COLLATE Chinese_PRC_CI_AS not null,
[Reader_type] [varchar] (10) COLLATE Chinese_PRC_CI_AS NULL,
[Reader_max_count] [int] not null,
[Reader_home] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL,
[Reader_phone] [varchar] (13) COLLATE Chinese_PRC_CI_AS NULL,
[Reader_money] [float] NULL,
[Reader_date] [datetime] NOT NULL
) ON [PRIMARY]
GO
Create table [dbo]. [Return_ifo] (
[Return _ reader_id] [varchar] (10) COLLATE Chinese_PRC_CI_AS not null,
[Return _ book_id] [varchar] (14) COLLATE Chinese_PRC_CI_AS not null,
[Return _ reader_name] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL,
[Borrow_time] [datetime] NULL,
[Return _ time] [datetime] NULL,
[Return _ book_name] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL,
[Return _ money] [float] NULL
) ON [PRIMARY]
GO
Create table [dbo]. [Result] (
[Book_id_del] [varchar] (14) COLLATE Chinese_PRC_CI_AS not null,
[Book_name_del] [varchar] (20) COLLATE Chinese_PRC_CI_AS not null,
[Book_auther_del] [varchar] (10) COLLATE Chinese_PRC_CI_AS not null,
[Book_publish_del] [varchar] (20) COLLATE Chinese_PRC_CI_AS not null,
[Book_letters_del] [text] COLLATE Chinese_PRC_CI_AS NULL,
[Book_count_del] [numeric] (2, 0) NULL,
[Book_publish_time_del] [datetime] NULL,
[Book_price_del] [money] NULL,
[Book_type_del] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL,
[Book_date_del] [datetime] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
Create view dbo. Borrow_view
AS
SELECT dbo. Borrow_ifo.Borrow_reader_id, dbo. Reader_ifo.Reader_id,
Dbo. Book_ifo.Book_id, dbo. Reader_ifo.Reader_name, dbo. Reader_ifo.Reader_money,
Dbo. Borrow_ifo.Borrow_book_count, dbo. Book_ifo.Book_name,
Dbo. Book_ifo.Book_publish, dbo. Book_ifo.Book_price, dbo. Book_ifo.Book_type,
Dbo. Book_ifo.Book_letters
FROM dbo. Borrow_ifo INNER JOIN
Dbo. Reader_ifo ON
Dbo. Borrow_ifo.Borrow_reader_id = dbo. Reader_ifo.Reader_id INNER JOIN
Dbo. Book_ifo ON dbo. Borrow_ifo.Borrow_book_id = dbo. Book_ifo.Book_id
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO