Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Errors Running database Scripts

Author  Topic 

gopalbulusu
Starting Member

1 Post

Posted - 2003-01-01 : 19:54:38
hai,

i have to create a executable file in VB to create a SqlServer 7 (desktop server) database for my project using ADO and other VB commands.

i was successfull in creating a database "MyDatabase" with help of connection and connection.execute " create database ....."

i generated Scripts for the tables, Views and procedures

After creating the database when i tried to create tables with the command..

c:\mssql7\binn> isql -S ServerName -d MyDatabase -i Scriptfilename.sql -U sa (enter key)
I was prompted for password and i typed it

during execution it generated
1> 2> 3> .........
2185 > Msg 170 , level 15 ,state 1, server servername , line 1
line 1 : Incorrect syntax near ' '

but when i tried to execute the same script file in Query Analyzer it executed with out errors

what is the problem . can any one suggest a solution
is there any way to execute sql script files from VB

bye
gopal

ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2003-01-01 : 20:33:28
Can you post Scriptfilename.sql?
You didn't create this .sql file in SQL SERVER 2000 by any chance did you?
quote:

when i tried to execute the same script file in Query Analyzer it executed with out errors



You did this in SQL Server 7.0 correct?

This could be your problem.
FROM BOL.


In this example, a table named table contains columns tablename, user, select, insert, and so on. Because TABLE, SELECT, INSERT, UPDATE, and DELETE are reserved keywords, the identifiers must be delimited each time the objects are accessed.

SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE "table"
(
tablename char(128) NOT NULL,
"USER" char(128) NOT NULL,
"SELECT" char(128) NOT NULL,
"INSERT" char(128) NOT NULL,
"UPDATE" char(128) NOT NULL,
"DELETE" char(128) NOT NULL
)

If the SET QUOTED_IDENTIFIER option is not ON, the table and columns cannot be accessed unless bracket delimiters are used.

SET QUOTED_IDENTIFIER OFF
GO
SELECT *
FROM "table"

Here is the result set:

Msg 170, Level 15, State 1
Line 1: Incorrect syntax near 'table'.

Here is the result set (using bracket delimiters):

SET QUOTED_IDENTIFIER OFF
GO
SELECT *
FROM [table]




Edited by - ValterBorges on 01/01/2003 20:41:32
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2003-01-01 : 23:13:20
Try using the profiler to see the commands that are being send.
Also create a small test script to run to make sure that something works.

create table test (i int)
is a good start

osql has replaced isql now.



==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -