It handles everything. You could execute any valid statement. How did you
execute them? As a one string for all statements or not. If yes, then you
could try to execute them separating by semicolon (;) or execute them
one-by-one
> OK Thanks!
> I have now parsed the items into one text string in C++ - and I took away
> all the "GO" in the SQL string. But now I receive error from the SQL
Server:
> Server: Msg 111, Level 15, State 1, Line 354
> 'CREATE PROCEDURE' must be the first statement in a query batch.
> So the question here is what to do with StoredProcedure in this file? It
> seems like it only handles Tables without "GO" statement
> - Lars
> > Hi,
> > Do not know anything about C++, but in VB I could use FileSystemObject
> class
> > library to read text files. Then you would need to chunk that text to
> parts
> > between GOs (provider does not understand GO statements) and execute
that
> > string using Execute method of Connection
> > It would look like
> > MyADOConnection.Execute "CREATE TABLE ...."
> > or
> > mySQL=load statement string here from file
> > MyADOConnection.Execute mySQL
> > --
> > Val Mazur
> > Microsoft MVP
> > > Yes!
> > > I really didn't think of that!
> > > If I Receive these items from the file in a CStringList. How do I open
> > that
> > > in SQL then? I'm not thinking of the Query Analyzer, but in c++ code?
> > > > Hi Lars,
> > > > What about keeping script in a file and load it from inside
> application
> > > and
> > > > execute that script same way as we execute usual SQL statements?
> > > > --
> > > > Val Mazur
> > > > Microsoft MVP
message
> > > > > Thanks - But that is exactly not what I want to do. I have to apps
> and
> > > > they
> > > > > have to create two seperate databases.
> > > > > I was thinking of using a script to create this database. Has
anyone
> > of
> > > > you
> > > > > used the REG_MULTI_SZ entry in Registry. How can I use this? Does
> > anyone
> > > > > know?
> > wrote
> > > in
> > > > > > Lars,
> > > > > > When you create a new db, all objects from the Model db are
copied
> > > > there.
> > > > > So
> > > > > > you will have to put SPs in the model db.
> > > > > > --
> > > > > > Dejan Sarka, SQL Server MVP
> > > > > > FAQ from Neil & others at: http://www.sqlserverfaq.com
> > > > > > Please reply only to the newsgroups.
> > > > > > PASS - the definitive, global community
> > > > > > for SQL Server professionals - http://www.sqlpass.org
> > message
> > > > > > > Hello!
> > > > > > > I would do the following. When the master-user is creating a
new
> > SQL
> > > > > > > Database - I would be happy to run a StoredProcedure and
create
> > all
> > > > > stored
> > > > > > > Procedures and Tables to this new database
> > > > > > > How can I achieve this?
> > > > > > > I tried inserting this SP into the MasterDB, but it replied
the
> > > error
> > > > > > saying
> > > > > > > that the tables nor the StoredProcedure was not there.
> > > > > > > Could anyone help me here?
> > > > > > > - Lars