Showing posts with label analyser. Show all posts
Showing posts with label analyser. Show all posts

Tuesday, March 27, 2012

Creating Views

I get the following error when i create views in a batch
using 'sql query analyser' as I want to create all the
views at one go. Is there solution.
Server: Msg 156, Level 15, State 1, Procedure View1, Line
11
Incorrect syntax near the keyword 'CREATE'.
Server: Msg 111, Level 15, State 1, Procedure View2, Line
11
'CREATE VIEW' must be the first statement in a query batch.
Make sure the=20
GO
keyword appears between each statement
CREATE VIEW <name>=20
AS
SELECT...
GO
CREATE VIEW <name>=20
AS
SELECT...
GO
--=20
Keith
"BILLI98" <billi98@.hotmail.com> wrote in message =
news:423401c42b7e$8b4560f0$a401280a@.phx.gbl...
> I get the following error when i create views in a batch=20
> using 'sql query analyser' as I want to create all the=20
> views at one go. Is there solution.
>=20
>=20
> Server: Msg 156, Level 15, State 1, Procedure View1, Line=20
> 11
> Incorrect syntax near the keyword 'CREATE'.
> Server: Msg 111, Level 15, State 1, Procedure View2, Line=20
> 11
> 'CREATE VIEW' must be the first statement in a query batch.
>=20
>=20
>
|||On Mon, 26 Apr 2004 04:06:37 -0700, BILLI98 wrote:

>I get the following error when i create views in a batch
>using 'sql query analyser' as I want to create all the
>views at one go. Is there solution.
>
>Server: Msg 156, Level 15, State 1, Procedure View1, Line
>11
>Incorrect syntax near the keyword 'CREATE'.
>Server: Msg 111, Level 15, State 1, Procedure View2, Line
>11
>'CREATE VIEW' must be the first statement in a query batch.
Just put in a "go" before each CREATE VIEW. Make sure you put GO at
the beginning of the line. Like this:
CREATE VIEW TestView
AS SELECT au_id FROM authors
GO
CREATE VIEW TestView2
AS SELECT au_lname FROM authors
GO
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)

Creating Views

I get the following error when i create views in a batch
using 'sql query analyser' as I want to create all the
views at one go. Is there solution.
Server: Msg 156, Level 15, State 1, Procedure View1, Line
11
Incorrect syntax near the keyword 'CREATE'.
Server: Msg 111, Level 15, State 1, Procedure View2, Line
11
'CREATE VIEW' must be the first statement in a query batch.Make sure the GO
keyword appears between each statement
CREATE VIEW <name> AS
SELECT...
GO
CREATE VIEW <name> AS
SELECT...
GO
-- Keith
"BILLI98" <billi98@.hotmail.com> wrote in message =news:423401c42b7e$8b4560f0$a401280a@.phx.gbl...
> I get the following error when i create views in a batch > using 'sql query analyser' as I want to create all the > views at one go. Is there solution.
> > > Server: Msg 156, Level 15, State 1, Procedure View1, Line > 11
> Incorrect syntax near the keyword 'CREATE'.
> Server: Msg 111, Level 15, State 1, Procedure View2, Line > 11
> 'CREATE VIEW' must be the first statement in a query batch.
> > >|||On Mon, 26 Apr 2004 04:06:37 -0700, BILLI98 wrote:
>I get the following error when i create views in a batch
>using 'sql query analyser' as I want to create all the
>views at one go. Is there solution.
>
>Server: Msg 156, Level 15, State 1, Procedure View1, Line
>11
>Incorrect syntax near the keyword 'CREATE'.
>Server: Msg 111, Level 15, State 1, Procedure View2, Line
>11
>'CREATE VIEW' must be the first statement in a query batch.
Just put in a "go" before each CREATE VIEW. Make sure you put GO at
the beginning of the line. Like this:
CREATE VIEW TestView
AS SELECT au_id FROM authors
GO
CREATE VIEW TestView2
AS SELECT au_lname FROM authors
GO
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)

Creating Views

I get the following error when i create views in a batch
using 'sql query analyser' as I want to create all the
views at one go. Is there solution.
Server: Msg 156, Level 15, State 1, Procedure View1, Line
11
Incorrect syntax near the keyword 'CREATE'.
Server: Msg 111, Level 15, State 1, Procedure View2, Line
11
'CREATE VIEW' must be the first statement in a query batch.Make sure the=20
GO
keyword appears between each statement
CREATE VIEW <name>=20
AS
SELECT...
GO
CREATE VIEW <name>=20
AS
SELECT...
GO
--=20
Keith
"BILLI98" <billi98@.hotmail.com> wrote in message =
news:423401c42b7e$8b4560f0$a401280a@.phx.gbl...
> I get the following error when i create views in a batch=20
> using 'sql query analyser' as I want to create all the=20
> views at one go. Is there solution.
>=20
>=20
> Server: Msg 156, Level 15, State 1, Procedure View1, Line=20
> 11
> Incorrect syntax near the keyword 'CREATE'.
> Server: Msg 111, Level 15, State 1, Procedure View2, Line=20
> 11
> 'CREATE VIEW' must be the first statement in a query batch.
>=20
>=20
>|||On Mon, 26 Apr 2004 04:06:37 -0700, BILLI98 wrote:

>I get the following error when i create views in a batch
>using 'sql query analyser' as I want to create all the
>views at one go. Is there solution.
>
>Server: Msg 156, Level 15, State 1, Procedure View1, Line
>11
>Incorrect syntax near the keyword 'CREATE'.
>Server: Msg 111, Level 15, State 1, Procedure View2, Line
>11
>'CREATE VIEW' must be the first statement in a query batch.
Just put in a "go" before each CREATE VIEW. Make sure you put GO at
the beginning of the line. Like this:
CREATE VIEW TestView
AS SELECT au_id FROM authors
GO
CREATE VIEW TestView2
AS SELECT au_lname FROM authors
GO
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)

Sunday, March 25, 2012

Creating View

Dear Sender,
I know that this is b'coz of GO statement. but GO is not a
T-SQL command and it works only inside Query analyser. if
the same string i execute through VB code by using
connection.execute, it doesn't recognise GO so i removed
it. It works for creating tables if i remove GO and
execute through VB-code. now i have to run this
query "CREATE VIEW" from my vb code and at one go as i do
for tables, i want to create all the views. ur suggestions
are welcome.
Billi98
You cannot combine CREATE VIEW with any other command in the same batch ("execution"). So you need to loop the
input file, and each time you find a GO, execute what you have in the buffer.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"billi98" <anonymous@.discussions.microsoft.com> wrote in message
news:49f701c42c33$be5f7e20$a601280a@.phx.gbl...
> Dear Sender,
> I know that this is b'coz of GO statement. but GO is not a
> T-SQL command and it works only inside Query analyser. if
> the same string i execute through VB code by using
> connection.execute, it doesn't recognise GO so i removed
> it. It works for creating tables if i remove GO and
> execute through VB-code. now i have to run this
> query "CREATE VIEW" from my vb code and at one go as i do
> for tables, i want to create all the views. ur suggestions
> are welcome.
> Billi98
>

Creating View

Dear Sender,
I know that this is b'coz of GO statement. but GO is not a
T-SQL command and it works only inside Query analyser. if
the same string i execute through VB code by using
connection.execute, it doesn't recognise GO so i removed
it. It works for creating tables if i remove GO and
execute through VB-code. now i have to run this
query "CREATE VIEW" from my vb code and at one go as i do
for tables, i want to create all the views. ur suggestions
are welcome.
Billi98Hello,
The GO statement only works through osql and isql (or in
this case Query Analyser).
All it does is signal the end of Transact-SQL statements,
including creating views SP or tables.
To be honest I am not too sure what your asking, you do
not actually need it when you are creating a view, but its
a 'nice to have' is you have a script you need running
though QA.
J
>--Original Message--
>Dear Sender,
>I know that this is b'coz of GO statement. but GO is not
a
>T-SQL command and it works only inside Query analyser. if
>the same string i execute through VB code by using
>connection.execute, it doesn't recognise GO so i removed
>it. It works for creating tables if i remove GO and
>execute through VB-code. now i have to run this
>query "CREATE VIEW" from my vb code and at one go as i do
>for tables, i want to create all the views. ur
suggestions
>are welcome.
>Billi98
>
>.
>|||You cannot combine CREATE VIEW with any other command in the same batch ("execution"). So you need to loop the
input file, and each time you find a GO, execute what you have in the buffer.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"billi98" <anonymous@.discussions.microsoft.com> wrote in message
news:49f701c42c33$be5f7e20$a601280a@.phx.gbl...
> Dear Sender,
> I know that this is b'coz of GO statement. but GO is not a
> T-SQL command and it works only inside Query analyser. if
> the same string i execute through VB code by using
> connection.execute, it doesn't recognise GO so i removed
> it. It works for creating tables if i remove GO and
> execute through VB-code. now i have to run this
> query "CREATE VIEW" from my vb code and at one go as i do
> for tables, i want to create all the views. ur suggestions
> are welcome.
> Billi98
>

Creating View

Dear Sender,
I know that this is b'coz of GO statement. but GO is not a
T-SQL command and it works only inside Query analyser. if
the same string i execute through VB code by using
connection.execute, it doesn't recognise GO so i removed
it. It works for creating tables if i remove GO and
execute through VB-code. now i have to run this
query "CREATE VIEW" from my vb code and at one go as i do
for tables, i want to create all the views. ur suggestions
are welcome.
Billi98You cannot combine CREATE VIEW with any other command in the same batch ("ex
ecution"). So you need to loop the
input file, and each time you find a GO, execute what you have in the buffer
.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"billi98" <anonymous@.discussions.microsoft.com> wrote in message
news:49f701c42c33$be5f7e20$a601280a@.phx.gbl...
> Dear Sender,
> I know that this is b'coz of GO statement. but GO is not a
> T-SQL command and it works only inside Query analyser. if
> the same string i execute through VB code by using
> connection.execute, it doesn't recognise GO so i removed
> it. It works for creating tables if i remove GO and
> execute through VB-code. now i have to run this
> query "CREATE VIEW" from my vb code and at one go as i do
> for tables, i want to create all the views. ur suggestions
> are welcome.
> Billi98
>

Tuesday, February 14, 2012

Creating database, not showing in EM in SQL 7

I am running Sql 7 on windows NT.
I am trying to create a database by opening the Query Analyser and
entering the following:
create database ScriptTest
on
( Name = 'ScriptTest_Data',
Filename = 'c:\mssql7\data\ScriptTest_Data.mdf',
Size = 5MB,
Maxsize = 25MB,
FileGrowth = 5MB )
Log on
( Name = 'ScriptTest_log',
Filename = 'c:\mssql7\data\ScriptTest_Log.ldf',
Size = 2MB,
Maxsize = 12MB,
FileGrowth = 20% )
The 2 data files are created fine. But it is not showing in the
Enterprise Manager.
Now, when I opened the Query Analyser, the DB is showing Master. Is
this correct?
Actually, I also found that if I create a database in the Query Analyser
- it shows in the Query analysers drop down box, but not in EM.
If I create it in EM, it shows in EM but not in Query Analyser.
Why'?
Thanks,
TomYou need to refresh the EM database tree manually in order for databases
created outside the EM environment to show up.
--
Hope this helps.
Dan Guzman
SQL Server MVP
--
SQL FAQ links (courtesy Neil Pike):
http://www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
http://www.sqlserverfaq.com
http://www.mssqlserver.com/faq
--
"Thomas Scheiderich" <tfs@.deltanet.com> wrote in message
news:3FB84C76.2050608@.deltanet.com...
> I am running Sql 7 on windows NT.
> I am trying to create a database by opening the Query Analyser and
> entering the following:
> create database ScriptTest
> on
> ( Name = 'ScriptTest_Data',
> Filename = 'c:\mssql7\data\ScriptTest_Data.mdf',
> Size = 5MB,
> Maxsize = 25MB,
> FileGrowth = 5MB )
> Log on
> ( Name = 'ScriptTest_log',
> Filename = 'c:\mssql7\data\ScriptTest_Log.ldf',
> Size = 2MB,
> Maxsize = 12MB,
> FileGrowth = 20% )
> The 2 data files are created fine. But it is not showing in the
> Enterprise Manager.
> Now, when I opened the Query Analyser, the DB is showing Master. Is
> this correct?
> Actually, I also found that if I create a database in the Query
Analyser
> - it shows in the Query analysers drop down box, but not in EM.
> If I create it in EM, it shows in EM but not in Query Analyser.
> Why'?
> Thanks,
> Tom
>