when I right ona table in the object browser in query analyzer it opens the
selected table,
in some tables I can edit the content in some, I can't,
do you have any idea?
Thanks
IlannHi,
You may not have rights to edit those tables. Execute sp_helprotect
'null','tablename' and see if you have permissions for those tables.
Thanks
Hari
SQL Server MVP
"Ilann" <ilann@.free.fr> wrote in message
news:O5dRcFyVFHA.2684@.TK2MSFTNGP09.phx.gbl...
> when I right ona table in the object browser in query analyzer it opens
> the selected table,
> in some tables I can edit the content in some, I can't,
> do you have any idea?
> Thanks
> null,'tablename' Ilann
>|||I got this:
There are no matching rows on which to report.
Ilann
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:euLXhIyVFHA.1404@.TK2MSFTNGP09.phx.gbl...
> Hi,
> You may not have rights to edit those tables. Execute sp_helprotect
> 'null','tablename' and see if you have permissions for those tables.
> Thanks
> Hari
> SQL Server MVP
> "Ilann" <ilann@.free.fr> wrote in message
> news:O5dRcFyVFHA.2684@.TK2MSFTNGP09.phx.gbl...
>> when I right ona table in the object browser in query analyzer it opens
>> the selected table,
>> in some tables I can edit the content in some, I can't,
>> do you have any idea?
>> Thanks
>> null,'tablename' Ilann
>>
>
>|||Ilann wrote:
> when I right ona table in the object browser in query analyzer it
> opens the selected table,
> in some tables I can edit the content in some, I can't,
> do you have any idea?
> Thanks
> Ilann
I've noticed that in past testing if a table had an indentity column, I
could edit it. Without one, I could not. That may be a bit of a
simplification. It could be related to a whether the table has a PK or
not or a unique index.
--
David Gugick
Imceda Software
www.imceda.com
Showing posts with label content. Show all posts
Showing posts with label content. Show all posts
Wednesday, March 21, 2012
open table
when I right ona table in the object browser in query analyzer it opens the
selected table,
in some tables I can edit the content in some, I can't,
do you have any idea?
Thanks
Ilann
Hi,
You may not have rights to edit those tables. Execute sp_helprotect
'null','tablename' and see if you have permissions for those tables.
Thanks
Hari
SQL Server MVP
"Ilann" <ilann@.free.fr> wrote in message
news:O5dRcFyVFHA.2684@.TK2MSFTNGP09.phx.gbl...
> when I right ona table in the object browser in query analyzer it opens
> the selected table,
> in some tables I can edit the content in some, I can't,
> do you have any idea?
> Thanks
> null,'tablename' Ilann
>
|||I got this:
There are no matching rows on which to report.
Ilann
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:euLXhIyVFHA.1404@.TK2MSFTNGP09.phx.gbl...
> Hi,
> You may not have rights to edit those tables. Execute sp_helprotect
> 'null','tablename' and see if you have permissions for those tables.
> Thanks
> Hari
> SQL Server MVP
> "Ilann" <ilann@.free.fr> wrote in message
> news:O5dRcFyVFHA.2684@.TK2MSFTNGP09.phx.gbl...
>
>
|||Ilann wrote:
> when I right ona table in the object browser in query analyzer it
> opens the selected table,
> in some tables I can edit the content in some, I can't,
> do you have any idea?
> Thanks
> Ilann
I've noticed that in past testing if a table had an indentity column, I
could edit it. Without one, I could not. That may be a bit of a
simplification. It could be related to a whether the table has a PK or
not or a unique index.
David Gugick
Imceda Software
www.imceda.com
selected table,
in some tables I can edit the content in some, I can't,
do you have any idea?
Thanks
Ilann
Hi,
You may not have rights to edit those tables. Execute sp_helprotect
'null','tablename' and see if you have permissions for those tables.
Thanks
Hari
SQL Server MVP
"Ilann" <ilann@.free.fr> wrote in message
news:O5dRcFyVFHA.2684@.TK2MSFTNGP09.phx.gbl...
> when I right ona table in the object browser in query analyzer it opens
> the selected table,
> in some tables I can edit the content in some, I can't,
> do you have any idea?
> Thanks
> null,'tablename' Ilann
>
|||I got this:
There are no matching rows on which to report.
Ilann
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:euLXhIyVFHA.1404@.TK2MSFTNGP09.phx.gbl...
> Hi,
> You may not have rights to edit those tables. Execute sp_helprotect
> 'null','tablename' and see if you have permissions for those tables.
> Thanks
> Hari
> SQL Server MVP
> "Ilann" <ilann@.free.fr> wrote in message
> news:O5dRcFyVFHA.2684@.TK2MSFTNGP09.phx.gbl...
>
>
|||Ilann wrote:
> when I right ona table in the object browser in query analyzer it
> opens the selected table,
> in some tables I can edit the content in some, I can't,
> do you have any idea?
> Thanks
> Ilann
I've noticed that in past testing if a table had an indentity column, I
could edit it. Without one, I could not. That may be a bit of a
simplification. It could be related to a whether the table has a PK or
not or a unique index.
David Gugick
Imceda Software
www.imceda.com
open table
when I right ona table in the object browser in query analyzer it opens the
selected table,
in some tables I can edit the content in some, I can't,
do you have any idea?
Thanks
IlannHi,
You may not have rights to edit those tables. Execute sp_helprotect
'null','tablename' and see if you have permissions for those tables.
Thanks
Hari
SQL Server MVP
"Ilann" <ilann@.free.fr> wrote in message
news:O5dRcFyVFHA.2684@.TK2MSFTNGP09.phx.gbl...
> when I right ona table in the object browser in query analyzer it opens
> the selected table,
> in some tables I can edit the content in some, I can't,
> do you have any idea?
> Thanks
> null,'tablename' Ilann
>|||I got this:
There are no matching rows on which to report.
Ilann
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:euLXhIyVFHA.1404@.TK2MSFTNGP09.phx.gbl...
> Hi,
> You may not have rights to edit those tables. Execute sp_helprotect
> 'null','tablename' and see if you have permissions for those tables.
> Thanks
> Hari
> SQL Server MVP
> "Ilann" <ilann@.free.fr> wrote in message
> news:O5dRcFyVFHA.2684@.TK2MSFTNGP09.phx.gbl...
>
>|||Ilann wrote:
> when I right ona table in the object browser in query analyzer it
> opens the selected table,
> in some tables I can edit the content in some, I can't,
> do you have any idea?
> Thanks
> Ilann
I've noticed that in past testing if a table had an indentity column, I
could edit it. Without one, I could not. That may be a bit of a
simplification. It could be related to a whether the table has a PK or
not or a unique index.
David Gugick
Imceda Software
www.imceda.comsql
selected table,
in some tables I can edit the content in some, I can't,
do you have any idea?
Thanks
IlannHi,
You may not have rights to edit those tables. Execute sp_helprotect
'null','tablename' and see if you have permissions for those tables.
Thanks
Hari
SQL Server MVP
"Ilann" <ilann@.free.fr> wrote in message
news:O5dRcFyVFHA.2684@.TK2MSFTNGP09.phx.gbl...
> when I right ona table in the object browser in query analyzer it opens
> the selected table,
> in some tables I can edit the content in some, I can't,
> do you have any idea?
> Thanks
> null,'tablename' Ilann
>|||I got this:
There are no matching rows on which to report.
Ilann
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:euLXhIyVFHA.1404@.TK2MSFTNGP09.phx.gbl...
> Hi,
> You may not have rights to edit those tables. Execute sp_helprotect
> 'null','tablename' and see if you have permissions for those tables.
> Thanks
> Hari
> SQL Server MVP
> "Ilann" <ilann@.free.fr> wrote in message
> news:O5dRcFyVFHA.2684@.TK2MSFTNGP09.phx.gbl...
>
>|||Ilann wrote:
> when I right ona table in the object browser in query analyzer it
> opens the selected table,
> in some tables I can edit the content in some, I can't,
> do you have any idea?
> Thanks
> Ilann
I've noticed that in past testing if a table had an indentity column, I
could edit it. Without one, I could not. That may be a bit of a
simplification. It could be related to a whether the table has a PK or
not or a unique index.
David Gugick
Imceda Software
www.imceda.comsql
Friday, March 9, 2012
Open a script file for a script
Hi,
Is it possible to open a sql file a run the content from another file?
MySQL can do it using the "source" function. (http://dev.mysql.com/doc/
refman/5.0/en/batch-commands.html).
I saw this news
[url]http://groups.google.com.au/group/microsoft.public.sqlserver.server/browse_thread/thread/18aa1a599d5e4ec/7ea0f09197e729ee?lnk=gst&q=run+file+script&rnum=3& hl=en#7ea0f09197e729ee[/url]
but it is not exactly what I want to do.
Let me know if it's possible.
Thank you.
Ben
What tool are you using to run the script? Also, does the script file exist on the server machine or
the client machine?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
<benjamin.amiot@.gmail.com> wrote in message
news:1179729481.030659.246610@.n15g2000prd.googlegr oups.com...
> Hi,
> Is it possible to open a sql file a run the content from another file?
> MySQL can do it using the "source" function. (http://dev.mysql.com/doc/
> refman/5.0/en/batch-commands.html).
> I saw this news
> [url]http://groups.google.com.au/group/microsoft.public.sqlserver.server/browse_thread/thread/18aa1a599d5e4ec/7ea0f09197e729ee?lnk=gst&q=run+file+script&rnum=3& hl=en#7ea0f09197e729ee[/url]
> but it is not exactly what I want to do.
> Let me know if it's possible.
> Thank you.
> Ben
>
|||On May 21, 4:47 pm, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:[vbcol=seagreen]
> What tool are you using to run the script? Also, does the script file exist on the server machine or
> the client machine?
> --
> Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/tibor_karaszi
> <benjamin.am...@.gmail.com> wrote in message
> news:1179729481.030659.246610@.n15g2000prd.googlegr oups.com...
>
>
>
I'm using the SQL Server Management Studio.
The file will be run on the client machine.
The reason why I'm asking for this function is because we have 300+
SQL script files that need to be ran in a specific order. Opening them
1 by 1 and running them using the manager is *really* time consuming.
The final script that will run all the others will be used by my
client as a unique "run all" script.
Thank you for your answer.
Ben
|||You can run SSMS in "SQLCMD mode" (the Query menu) or use SQLCMD.EXE. If you do this, you can use :r
to have the tool to read a file. The file cannot contain GO (batch separator), at lest this was a
restriction last time I tested (2000).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
<benjamin.amiot@.gmail.com> wrote in message
news:1179731210.026500.253250@.r3g2000prh.googlegro ups.com...
> On May 21, 4:47 pm, "Tibor Karaszi"
> <tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> I'm using the SQL Server Management Studio.
> The file will be run on the client machine.
> The reason why I'm asking for this function is because we have 300+
> SQL script files that need to be ran in a specific order. Opening them
> 1 by 1 and running them using the manager is *really* time consuming.
> The final script that will run all the others will be used by my
> client as a unique "run all" script.
> Thank you for your answer.
> Ben
>
|||Since you need to run the 300+ files in a certain order, I would use a
simple vbscript and SMO to do the executes. Use the FileSystemObject to
open each file in the correct order (dos dir /b command output to file will
get you the list of files, which you can then order as appropriate), and
execute against a smo connection to the appropriate server/db.
TheSQLGuru
President
Indicium Resources, Inc.
<benjamin.amiot@.gmail.com> wrote in message
news:1179731210.026500.253250@.r3g2000prh.googlegro ups.com...
> On May 21, 4:47 pm, "Tibor Karaszi"
> <tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> I'm using the SQL Server Management Studio.
> The file will be run on the client machine.
> The reason why I'm asking for this function is because we have 300+
> SQL script files that need to be ran in a specific order. Opening them
> 1 by 1 and running them using the manager is *really* time consuming.
> The final script that will run all the others will be used by my
> client as a unique "run all" script.
> Thank you for your answer.
> Ben
>
|||On May 22, 4:30 am, "TheSQLGuru" <kgbo...@.earthlink.net> wrote:[vbcol=seagreen]
> Since you need to run the 300+ files in a certain order, I would use a
> simple vbscript and SMO to do the executes. Use the FileSystemObject to
> open each file in the correct order (dos dir /b command output to file will
> get you the list of files, which you can then order as appropriate), and
> execute against a smo connection to the appropriate server/db.
> --
> TheSQLGuru
> President
> Indicium Resources, Inc.
> <benjamin.am...@.gmail.com> wrote in message
> news:1179731210.026500.253250@.r3g2000prh.googlegro ups.com...
>
>
>
>
>
>
>
>
Ok,
I'll try both method and see which one is the easiest to implement.
Thank you for your messages.
Ben
|||On May 21, 6:43 pm, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:[vbcol=seagreen]
> You can run SSMS in "SQLCMD mode" (the Query menu) or use SQLCMD.EXE. If you do this, you can use :r
> to have the tool to read a file. The file cannot contain GO (batch separator), at lest this was a
> restriction last time I tested (2000).
> --
> Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/tibor_karaszi
> <benjamin.am...@.gmail.com> wrote in message
> news:1179731210.026500.253250@.r3g2000prh.googlegro ups.com...
>
>
>
>
>
>
>
>
Hi Tibor,
Thanks for your solution, but I won't be able to us it as most of the
files are using GO in them. I can't remove this command as the scripts
are generated by different teams in the company.
I'll try the solution of TheSQLGuru.
Ben
|||> Thanks for your solution, but I won't be able to us it as most of the
> files are using GO in them. I can't remove this command as the scripts
> are generated by different teams in the company.
This is one of the reasons to always read BOL. Reading current BOL, it seems like you *can* have
batch terminator in the inner script. Quotes from BOL:
"If the file contains Transact-SQL statements that arenot followed by GO, you must enter GO on the
line that follows :r."
"The file will be read and executed after a batch terminator is encountered. You can issue multiple
:r commands. The file may include any sqlcmd command. This includes the batch terminator GO."
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
<benjamin.amiot@.gmail.com> wrote in message
news:1179790434.126680.210820@.r3g2000prh.googlegro ups.com...
> On May 21, 6:43 pm, "Tibor Karaszi"
> <tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> Hi Tibor,
> Thanks for your solution, but I won't be able to us it as most of the
> files are using GO in them. I can't remove this command as the scripts
> are generated by different teams in the company.
> I'll try the solution of TheSQLGuru.
> Ben
>
Is it possible to open a sql file a run the content from another file?
MySQL can do it using the "source" function. (http://dev.mysql.com/doc/
refman/5.0/en/batch-commands.html).
I saw this news
[url]http://groups.google.com.au/group/microsoft.public.sqlserver.server/browse_thread/thread/18aa1a599d5e4ec/7ea0f09197e729ee?lnk=gst&q=run+file+script&rnum=3& hl=en#7ea0f09197e729ee[/url]
but it is not exactly what I want to do.
Let me know if it's possible.
Thank you.
Ben
What tool are you using to run the script? Also, does the script file exist on the server machine or
the client machine?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
<benjamin.amiot@.gmail.com> wrote in message
news:1179729481.030659.246610@.n15g2000prd.googlegr oups.com...
> Hi,
> Is it possible to open a sql file a run the content from another file?
> MySQL can do it using the "source" function. (http://dev.mysql.com/doc/
> refman/5.0/en/batch-commands.html).
> I saw this news
> [url]http://groups.google.com.au/group/microsoft.public.sqlserver.server/browse_thread/thread/18aa1a599d5e4ec/7ea0f09197e729ee?lnk=gst&q=run+file+script&rnum=3& hl=en#7ea0f09197e729ee[/url]
> but it is not exactly what I want to do.
> Let me know if it's possible.
> Thank you.
> Ben
>
|||On May 21, 4:47 pm, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:[vbcol=seagreen]
> What tool are you using to run the script? Also, does the script file exist on the server machine or
> the client machine?
> --
> Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/tibor_karaszi
> <benjamin.am...@.gmail.com> wrote in message
> news:1179729481.030659.246610@.n15g2000prd.googlegr oups.com...
>
>
>
I'm using the SQL Server Management Studio.
The file will be run on the client machine.
The reason why I'm asking for this function is because we have 300+
SQL script files that need to be ran in a specific order. Opening them
1 by 1 and running them using the manager is *really* time consuming.
The final script that will run all the others will be used by my
client as a unique "run all" script.
Thank you for your answer.
Ben
|||You can run SSMS in "SQLCMD mode" (the Query menu) or use SQLCMD.EXE. If you do this, you can use :r
to have the tool to read a file. The file cannot contain GO (batch separator), at lest this was a
restriction last time I tested (2000).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
<benjamin.amiot@.gmail.com> wrote in message
news:1179731210.026500.253250@.r3g2000prh.googlegro ups.com...
> On May 21, 4:47 pm, "Tibor Karaszi"
> <tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> I'm using the SQL Server Management Studio.
> The file will be run on the client machine.
> The reason why I'm asking for this function is because we have 300+
> SQL script files that need to be ran in a specific order. Opening them
> 1 by 1 and running them using the manager is *really* time consuming.
> The final script that will run all the others will be used by my
> client as a unique "run all" script.
> Thank you for your answer.
> Ben
>
|||Since you need to run the 300+ files in a certain order, I would use a
simple vbscript and SMO to do the executes. Use the FileSystemObject to
open each file in the correct order (dos dir /b command output to file will
get you the list of files, which you can then order as appropriate), and
execute against a smo connection to the appropriate server/db.
TheSQLGuru
President
Indicium Resources, Inc.
<benjamin.amiot@.gmail.com> wrote in message
news:1179731210.026500.253250@.r3g2000prh.googlegro ups.com...
> On May 21, 4:47 pm, "Tibor Karaszi"
> <tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> I'm using the SQL Server Management Studio.
> The file will be run on the client machine.
> The reason why I'm asking for this function is because we have 300+
> SQL script files that need to be ran in a specific order. Opening them
> 1 by 1 and running them using the manager is *really* time consuming.
> The final script that will run all the others will be used by my
> client as a unique "run all" script.
> Thank you for your answer.
> Ben
>
|||On May 22, 4:30 am, "TheSQLGuru" <kgbo...@.earthlink.net> wrote:[vbcol=seagreen]
> Since you need to run the 300+ files in a certain order, I would use a
> simple vbscript and SMO to do the executes. Use the FileSystemObject to
> open each file in the correct order (dos dir /b command output to file will
> get you the list of files, which you can then order as appropriate), and
> execute against a smo connection to the appropriate server/db.
> --
> TheSQLGuru
> President
> Indicium Resources, Inc.
> <benjamin.am...@.gmail.com> wrote in message
> news:1179731210.026500.253250@.r3g2000prh.googlegro ups.com...
>
>
>
>
>
>
>
>
Ok,
I'll try both method and see which one is the easiest to implement.
Thank you for your messages.
Ben
|||On May 21, 6:43 pm, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:[vbcol=seagreen]
> You can run SSMS in "SQLCMD mode" (the Query menu) or use SQLCMD.EXE. If you do this, you can use :r
> to have the tool to read a file. The file cannot contain GO (batch separator), at lest this was a
> restriction last time I tested (2000).
> --
> Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/tibor_karaszi
> <benjamin.am...@.gmail.com> wrote in message
> news:1179731210.026500.253250@.r3g2000prh.googlegro ups.com...
>
>
>
>
>
>
>
>
Hi Tibor,
Thanks for your solution, but I won't be able to us it as most of the
files are using GO in them. I can't remove this command as the scripts
are generated by different teams in the company.
I'll try the solution of TheSQLGuru.
Ben
|||> Thanks for your solution, but I won't be able to us it as most of the
> files are using GO in them. I can't remove this command as the scripts
> are generated by different teams in the company.
This is one of the reasons to always read BOL. Reading current BOL, it seems like you *can* have
batch terminator in the inner script. Quotes from BOL:
"If the file contains Transact-SQL statements that arenot followed by GO, you must enter GO on the
line that follows :r."
"The file will be read and executed after a batch terminator is encountered. You can issue multiple
:r commands. The file may include any sqlcmd command. This includes the batch terminator GO."
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
<benjamin.amiot@.gmail.com> wrote in message
news:1179790434.126680.210820@.r3g2000prh.googlegro ups.com...
> On May 21, 6:43 pm, "Tibor Karaszi"
> <tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> Hi Tibor,
> Thanks for your solution, but I won't be able to us it as most of the
> files are using GO in them. I can't remove this command as the scripts
> are generated by different teams in the company.
> I'll try the solution of TheSQLGuru.
> Ben
>
Open a script file for a script
Hi,
Is it possible to open a sql file a run the content from another file?
MySQL can do it using the "source" function. (http://dev.mysql.com/doc/
refman/5.0/en/batch-commands.html).
I saw this news
http://groups.google.com.au/group/microsoft.public.sqlserver.server/browse_thread/thread/18aa1a599d5e4ec/7ea0f09197e729ee?lnk=gst&q=run+file+script&rnum=3&hl=en#7ea0f09197e729ee
but it is not exactly what I want to do.
Let me know if it's possible.
Thank you.
BenWhat tool are you using to run the script? Also, does the script file exist on the server machine or
the client machine?
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
<benjamin.amiot@.gmail.com> wrote in message
news:1179729481.030659.246610@.n15g2000prd.googlegroups.com...
> Hi,
> Is it possible to open a sql file a run the content from another file?
> MySQL can do it using the "source" function. (http://dev.mysql.com/doc/
> refman/5.0/en/batch-commands.html).
> I saw this news
> http://groups.google.com.au/group/microsoft.public.sqlserver.server/browse_thread/thread/18aa1a599d5e4ec/7ea0f09197e729ee?lnk=gst&q=run+file+script&rnum=3&hl=en#7ea0f09197e729ee
> but it is not exactly what I want to do.
> Let me know if it's possible.
> Thank you.
> Ben
>|||On May 21, 4:47 pm, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> What tool are you using to run the script? Also, does the script file exist on the server machine or
> the client machine?
> --
> Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/tibor_karaszi
> <benjamin.am...@.gmail.com> wrote in message
> news:1179729481.030659.246610@.n15g2000prd.googlegroups.com...
> > Hi,
> > Is it possible to open a sql file a run the content from another file?
> > MySQL can do it using the "source" function. (http://dev.mysql.com/doc/
> > refman/5.0/en/batch-commands.html).
> > I saw this news
> >http://groups.google.com.au/group/microsoft.public.sqlserver.server/b...
> > but it is not exactly what I want to do.
> > Let me know if it's possible.
> > Thank you.
> > Ben
I'm using the SQL Server Management Studio.
The file will be run on the client machine.
The reason why I'm asking for this function is because we have 300+
SQL script files that need to be ran in a specific order. Opening them
1 by 1 and running them using the manager is *really* time consuming.
The final script that will run all the others will be used by my
client as a unique "run all" script.
Thank you for your answer.
Ben|||You can run SSMS in "SQLCMD mode" (the Query menu) or use SQLCMD.EXE. If you do this, you can use :r
to have the tool to read a file. The file cannot contain GO (batch separator), at lest this was a
restriction last time I tested (2000).
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
<benjamin.amiot@.gmail.com> wrote in message
news:1179731210.026500.253250@.r3g2000prh.googlegroups.com...
> On May 21, 4:47 pm, "Tibor Karaszi"
> <tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
>> What tool are you using to run the script? Also, does the script file exist on the server machine
>> or
>> the client machine?
>> --
>> Tibor Karaszi, SQL Server
>> MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/tibor_karaszi
>> <benjamin.am...@.gmail.com> wrote in message
>> news:1179729481.030659.246610@.n15g2000prd.googlegroups.com...
>> > Hi,
>> > Is it possible to open a sql file a run the content from another file?
>> > MySQL can do it using the "source" function. (http://dev.mysql.com/doc/
>> > refman/5.0/en/batch-commands.html).
>> > I saw this news
>> >http://groups.google.com.au/group/microsoft.public.sqlserver.server/b...
>> > but it is not exactly what I want to do.
>> > Let me know if it's possible.
>> > Thank you.
>> > Ben
> I'm using the SQL Server Management Studio.
> The file will be run on the client machine.
> The reason why I'm asking for this function is because we have 300+
> SQL script files that need to be ran in a specific order. Opening them
> 1 by 1 and running them using the manager is *really* time consuming.
> The final script that will run all the others will be used by my
> client as a unique "run all" script.
> Thank you for your answer.
> Ben
>|||Since you need to run the 300+ files in a certain order, I would use a
simple vbscript and SMO to do the executes. Use the FileSystemObject to
open each file in the correct order (dos dir /b command output to file will
get you the list of files, which you can then order as appropriate), and
execute against a smo connection to the appropriate server/db.
--
TheSQLGuru
President
Indicium Resources, Inc.
<benjamin.amiot@.gmail.com> wrote in message
news:1179731210.026500.253250@.r3g2000prh.googlegroups.com...
> On May 21, 4:47 pm, "Tibor Karaszi"
> <tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
>> What tool are you using to run the script? Also, does the script file
>> exist on the server machine or
>> the client machine?
>> --
>> Tibor Karaszi, SQL Server
>> MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/tibor_karaszi
>> <benjamin.am...@.gmail.com> wrote in message
>> news:1179729481.030659.246610@.n15g2000prd.googlegroups.com...
>> > Hi,
>> > Is it possible to open a sql file a run the content from another file?
>> > MySQL can do it using the "source" function. (http://dev.mysql.com/doc/
>> > refman/5.0/en/batch-commands.html).
>> > I saw this news
>> >http://groups.google.com.au/group/microsoft.public.sqlserver.server/b...
>> > but it is not exactly what I want to do.
>> > Let me know if it's possible.
>> > Thank you.
>> > Ben
> I'm using the SQL Server Management Studio.
> The file will be run on the client machine.
> The reason why I'm asking for this function is because we have 300+
> SQL script files that need to be ran in a specific order. Opening them
> 1 by 1 and running them using the manager is *really* time consuming.
> The final script that will run all the others will be used by my
> client as a unique "run all" script.
> Thank you for your answer.
> Ben
>|||On May 22, 4:30 am, "TheSQLGuru" <kgbo...@.earthlink.net> wrote:
> Since you need to run the 300+ files in a certain order, I would use a
> simple vbscript and SMO to do the executes. Use the FileSystemObject to
> open each file in the correct order (dos dir /b command output to file will
> get you the list of files, which you can then order as appropriate), and
> execute against a smo connection to the appropriate server/db.
> --
> TheSQLGuru
> President
> Indicium Resources, Inc.
> <benjamin.am...@.gmail.com> wrote in message
> news:1179731210.026500.253250@.r3g2000prh.googlegroups.com...
> > On May 21, 4:47 pm, "Tibor Karaszi"
> > <tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> >> What tool are you using to run the script? Also, does the script file
> >> exist on the server machine or
> >> the client machine?
> >> --
> >> Tibor Karaszi, SQL Server
> >> MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/...
> >> <benjamin.am...@.gmail.com> wrote in message
> >>news:1179729481.030659.246610@.n15g2000prd.googlegroups.com...
> >> > Hi,
> >> > Is it possible to open a sql file a run the content from another file?
> >> > MySQL can do it using the "source" function. (http://dev.mysql.com/doc/
> >> > refman/5.0/en/batch-commands.html).
> >> > I saw this news
> >> >http://groups.google.com.au/group/microsoft.public.sqlserver.server/b...
> >> > but it is not exactly what I want to do.
> >> > Let me know if it's possible.
> >> > Thank you.
> >> > Ben
> > I'm using the SQL Server Management Studio.
> > The file will be run on the client machine.
> > The reason why I'm asking for this function is because we have 300+
> > SQL script files that need to be ran in a specific order. Opening them
> > 1 by 1 and running them using the manager is *really* time consuming.
> > The final script that will run all the others will be used by my
> > client as a unique "run all" script.
> > Thank you for your answer.
> > Ben
Ok,
I'll try both method and see which one is the easiest to implement.
Thank you for your messages.
Ben|||On May 21, 6:43 pm, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> You can run SSMS in "SQLCMD mode" (the Query menu) or use SQLCMD.EXE. If you do this, you can use :r
> to have the tool to read a file. The file cannot contain GO (batch separator), at lest this was a
> restriction last time I tested (2000).
> --
> Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/tibor_karaszi
> <benjamin.am...@.gmail.com> wrote in message
> news:1179731210.026500.253250@.r3g2000prh.googlegroups.com...
> > On May 21, 4:47 pm, "Tibor Karaszi"
> > <tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> >> What tool are you using to run the script? Also, does the script file exist on the server machine
> >> or
> >> the client machine?
> >> --
> >> Tibor Karaszi, SQL Server
> >> MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/...
> >> <benjamin.am...@.gmail.com> wrote in message
> >>news:1179729481.030659.246610@.n15g2000prd.googlegroups.com...
> >> > Hi,
> >> > Is it possible to open a sql file a run the content from another file?
> >> > MySQL can do it using the "source" function. (http://dev.mysql.com/doc/
> >> > refman/5.0/en/batch-commands.html).
> >> > I saw this news
> >> >http://groups.google.com.au/group/microsoft.public.sqlserver.server/b...
> >> > but it is not exactly what I want to do.
> >> > Let me know if it's possible.
> >> > Thank you.
> >> > Ben
> > I'm using the SQL Server Management Studio.
> > The file will be run on the client machine.
> > The reason why I'm asking for this function is because we have 300+
> > SQL script files that need to be ran in a specific order. Opening them
> > 1 by 1 and running them using the manager is *really* time consuming.
> > The final script that will run all the others will be used by my
> > client as a unique "run all" script.
> > Thank you for your answer.
> > Ben
Hi Tibor,
Thanks for your solution, but I won't be able to us it as most of the
files are using GO in them. I can't remove this command as the scripts
are generated by different teams in the company.
I'll try the solution of TheSQLGuru.
Ben|||> Thanks for your solution, but I won't be able to us it as most of the
> files are using GO in them. I can't remove this command as the scripts
> are generated by different teams in the company.
This is one of the reasons to always read BOL. Reading current BOL, it seems like you *can* have
batch terminator in the inner script. Quotes from BOL:
"If the file contains Transact-SQL statements that arenot followed by GO, you must enter GO on the
line that follows :r."
"The file will be read and executed after a batch terminator is encountered. You can issue multiple
:r commands. The file may include any sqlcmd command. This includes the batch terminator GO."
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
<benjamin.amiot@.gmail.com> wrote in message
news:1179790434.126680.210820@.r3g2000prh.googlegroups.com...
> On May 21, 6:43 pm, "Tibor Karaszi"
> <tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
>> You can run SSMS in "SQLCMD mode" (the Query menu) or use SQLCMD.EXE. If you do this, you can use
>> :r
>> to have the tool to read a file. The file cannot contain GO (batch separator), at lest this was a
>> restriction last time I tested (2000).
>> --
>> Tibor Karaszi, SQL Server
>> MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/tibor_karaszi
>> <benjamin.am...@.gmail.com> wrote in message
>> news:1179731210.026500.253250@.r3g2000prh.googlegroups.com...
>> > On May 21, 4:47 pm, "Tibor Karaszi"
>> > <tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
>> >> What tool are you using to run the script? Also, does the script file exist on the server
>> >> machine
>> >> or
>> >> the client machine?
>> >> --
>> >> Tibor Karaszi, SQL Server
>> >> MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/...
>> >> <benjamin.am...@.gmail.com> wrote in message
>> >>news:1179729481.030659.246610@.n15g2000prd.googlegroups.com...
>> >> > Hi,
>> >> > Is it possible to open a sql file a run the content from another file?
>> >> > MySQL can do it using the "source" function. (http://dev.mysql.com/doc/
>> >> > refman/5.0/en/batch-commands.html).
>> >> > I saw this news
>> >> >http://groups.google.com.au/group/microsoft.public.sqlserver.server/b...
>> >> > but it is not exactly what I want to do.
>> >> > Let me know if it's possible.
>> >> > Thank you.
>> >> > Ben
>> > I'm using the SQL Server Management Studio.
>> > The file will be run on the client machine.
>> > The reason why I'm asking for this function is because we have 300+
>> > SQL script files that need to be ran in a specific order. Opening them
>> > 1 by 1 and running them using the manager is *really* time consuming.
>> > The final script that will run all the others will be used by my
>> > client as a unique "run all" script.
>> > Thank you for your answer.
>> > Ben
> Hi Tibor,
> Thanks for your solution, but I won't be able to us it as most of the
> files are using GO in them. I can't remove this command as the scripts
> are generated by different teams in the company.
> I'll try the solution of TheSQLGuru.
> Ben
>
Is it possible to open a sql file a run the content from another file?
MySQL can do it using the "source" function. (http://dev.mysql.com/doc/
refman/5.0/en/batch-commands.html).
I saw this news
http://groups.google.com.au/group/microsoft.public.sqlserver.server/browse_thread/thread/18aa1a599d5e4ec/7ea0f09197e729ee?lnk=gst&q=run+file+script&rnum=3&hl=en#7ea0f09197e729ee
but it is not exactly what I want to do.
Let me know if it's possible.
Thank you.
BenWhat tool are you using to run the script? Also, does the script file exist on the server machine or
the client machine?
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
<benjamin.amiot@.gmail.com> wrote in message
news:1179729481.030659.246610@.n15g2000prd.googlegroups.com...
> Hi,
> Is it possible to open a sql file a run the content from another file?
> MySQL can do it using the "source" function. (http://dev.mysql.com/doc/
> refman/5.0/en/batch-commands.html).
> I saw this news
> http://groups.google.com.au/group/microsoft.public.sqlserver.server/browse_thread/thread/18aa1a599d5e4ec/7ea0f09197e729ee?lnk=gst&q=run+file+script&rnum=3&hl=en#7ea0f09197e729ee
> but it is not exactly what I want to do.
> Let me know if it's possible.
> Thank you.
> Ben
>|||On May 21, 4:47 pm, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> What tool are you using to run the script? Also, does the script file exist on the server machine or
> the client machine?
> --
> Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/tibor_karaszi
> <benjamin.am...@.gmail.com> wrote in message
> news:1179729481.030659.246610@.n15g2000prd.googlegroups.com...
> > Hi,
> > Is it possible to open a sql file a run the content from another file?
> > MySQL can do it using the "source" function. (http://dev.mysql.com/doc/
> > refman/5.0/en/batch-commands.html).
> > I saw this news
> >http://groups.google.com.au/group/microsoft.public.sqlserver.server/b...
> > but it is not exactly what I want to do.
> > Let me know if it's possible.
> > Thank you.
> > Ben
I'm using the SQL Server Management Studio.
The file will be run on the client machine.
The reason why I'm asking for this function is because we have 300+
SQL script files that need to be ran in a specific order. Opening them
1 by 1 and running them using the manager is *really* time consuming.
The final script that will run all the others will be used by my
client as a unique "run all" script.
Thank you for your answer.
Ben|||You can run SSMS in "SQLCMD mode" (the Query menu) or use SQLCMD.EXE. If you do this, you can use :r
to have the tool to read a file. The file cannot contain GO (batch separator), at lest this was a
restriction last time I tested (2000).
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
<benjamin.amiot@.gmail.com> wrote in message
news:1179731210.026500.253250@.r3g2000prh.googlegroups.com...
> On May 21, 4:47 pm, "Tibor Karaszi"
> <tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
>> What tool are you using to run the script? Also, does the script file exist on the server machine
>> or
>> the client machine?
>> --
>> Tibor Karaszi, SQL Server
>> MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/tibor_karaszi
>> <benjamin.am...@.gmail.com> wrote in message
>> news:1179729481.030659.246610@.n15g2000prd.googlegroups.com...
>> > Hi,
>> > Is it possible to open a sql file a run the content from another file?
>> > MySQL can do it using the "source" function. (http://dev.mysql.com/doc/
>> > refman/5.0/en/batch-commands.html).
>> > I saw this news
>> >http://groups.google.com.au/group/microsoft.public.sqlserver.server/b...
>> > but it is not exactly what I want to do.
>> > Let me know if it's possible.
>> > Thank you.
>> > Ben
> I'm using the SQL Server Management Studio.
> The file will be run on the client machine.
> The reason why I'm asking for this function is because we have 300+
> SQL script files that need to be ran in a specific order. Opening them
> 1 by 1 and running them using the manager is *really* time consuming.
> The final script that will run all the others will be used by my
> client as a unique "run all" script.
> Thank you for your answer.
> Ben
>|||Since you need to run the 300+ files in a certain order, I would use a
simple vbscript and SMO to do the executes. Use the FileSystemObject to
open each file in the correct order (dos dir /b command output to file will
get you the list of files, which you can then order as appropriate), and
execute against a smo connection to the appropriate server/db.
--
TheSQLGuru
President
Indicium Resources, Inc.
<benjamin.amiot@.gmail.com> wrote in message
news:1179731210.026500.253250@.r3g2000prh.googlegroups.com...
> On May 21, 4:47 pm, "Tibor Karaszi"
> <tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
>> What tool are you using to run the script? Also, does the script file
>> exist on the server machine or
>> the client machine?
>> --
>> Tibor Karaszi, SQL Server
>> MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/tibor_karaszi
>> <benjamin.am...@.gmail.com> wrote in message
>> news:1179729481.030659.246610@.n15g2000prd.googlegroups.com...
>> > Hi,
>> > Is it possible to open a sql file a run the content from another file?
>> > MySQL can do it using the "source" function. (http://dev.mysql.com/doc/
>> > refman/5.0/en/batch-commands.html).
>> > I saw this news
>> >http://groups.google.com.au/group/microsoft.public.sqlserver.server/b...
>> > but it is not exactly what I want to do.
>> > Let me know if it's possible.
>> > Thank you.
>> > Ben
> I'm using the SQL Server Management Studio.
> The file will be run on the client machine.
> The reason why I'm asking for this function is because we have 300+
> SQL script files that need to be ran in a specific order. Opening them
> 1 by 1 and running them using the manager is *really* time consuming.
> The final script that will run all the others will be used by my
> client as a unique "run all" script.
> Thank you for your answer.
> Ben
>|||On May 22, 4:30 am, "TheSQLGuru" <kgbo...@.earthlink.net> wrote:
> Since you need to run the 300+ files in a certain order, I would use a
> simple vbscript and SMO to do the executes. Use the FileSystemObject to
> open each file in the correct order (dos dir /b command output to file will
> get you the list of files, which you can then order as appropriate), and
> execute against a smo connection to the appropriate server/db.
> --
> TheSQLGuru
> President
> Indicium Resources, Inc.
> <benjamin.am...@.gmail.com> wrote in message
> news:1179731210.026500.253250@.r3g2000prh.googlegroups.com...
> > On May 21, 4:47 pm, "Tibor Karaszi"
> > <tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> >> What tool are you using to run the script? Also, does the script file
> >> exist on the server machine or
> >> the client machine?
> >> --
> >> Tibor Karaszi, SQL Server
> >> MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/...
> >> <benjamin.am...@.gmail.com> wrote in message
> >>news:1179729481.030659.246610@.n15g2000prd.googlegroups.com...
> >> > Hi,
> >> > Is it possible to open a sql file a run the content from another file?
> >> > MySQL can do it using the "source" function. (http://dev.mysql.com/doc/
> >> > refman/5.0/en/batch-commands.html).
> >> > I saw this news
> >> >http://groups.google.com.au/group/microsoft.public.sqlserver.server/b...
> >> > but it is not exactly what I want to do.
> >> > Let me know if it's possible.
> >> > Thank you.
> >> > Ben
> > I'm using the SQL Server Management Studio.
> > The file will be run on the client machine.
> > The reason why I'm asking for this function is because we have 300+
> > SQL script files that need to be ran in a specific order. Opening them
> > 1 by 1 and running them using the manager is *really* time consuming.
> > The final script that will run all the others will be used by my
> > client as a unique "run all" script.
> > Thank you for your answer.
> > Ben
Ok,
I'll try both method and see which one is the easiest to implement.
Thank you for your messages.
Ben|||On May 21, 6:43 pm, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> You can run SSMS in "SQLCMD mode" (the Query menu) or use SQLCMD.EXE. If you do this, you can use :r
> to have the tool to read a file. The file cannot contain GO (batch separator), at lest this was a
> restriction last time I tested (2000).
> --
> Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/tibor_karaszi
> <benjamin.am...@.gmail.com> wrote in message
> news:1179731210.026500.253250@.r3g2000prh.googlegroups.com...
> > On May 21, 4:47 pm, "Tibor Karaszi"
> > <tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> >> What tool are you using to run the script? Also, does the script file exist on the server machine
> >> or
> >> the client machine?
> >> --
> >> Tibor Karaszi, SQL Server
> >> MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/...
> >> <benjamin.am...@.gmail.com> wrote in message
> >>news:1179729481.030659.246610@.n15g2000prd.googlegroups.com...
> >> > Hi,
> >> > Is it possible to open a sql file a run the content from another file?
> >> > MySQL can do it using the "source" function. (http://dev.mysql.com/doc/
> >> > refman/5.0/en/batch-commands.html).
> >> > I saw this news
> >> >http://groups.google.com.au/group/microsoft.public.sqlserver.server/b...
> >> > but it is not exactly what I want to do.
> >> > Let me know if it's possible.
> >> > Thank you.
> >> > Ben
> > I'm using the SQL Server Management Studio.
> > The file will be run on the client machine.
> > The reason why I'm asking for this function is because we have 300+
> > SQL script files that need to be ran in a specific order. Opening them
> > 1 by 1 and running them using the manager is *really* time consuming.
> > The final script that will run all the others will be used by my
> > client as a unique "run all" script.
> > Thank you for your answer.
> > Ben
Hi Tibor,
Thanks for your solution, but I won't be able to us it as most of the
files are using GO in them. I can't remove this command as the scripts
are generated by different teams in the company.
I'll try the solution of TheSQLGuru.
Ben|||> Thanks for your solution, but I won't be able to us it as most of the
> files are using GO in them. I can't remove this command as the scripts
> are generated by different teams in the company.
This is one of the reasons to always read BOL. Reading current BOL, it seems like you *can* have
batch terminator in the inner script. Quotes from BOL:
"If the file contains Transact-SQL statements that arenot followed by GO, you must enter GO on the
line that follows :r."
"The file will be read and executed after a batch terminator is encountered. You can issue multiple
:r commands. The file may include any sqlcmd command. This includes the batch terminator GO."
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
<benjamin.amiot@.gmail.com> wrote in message
news:1179790434.126680.210820@.r3g2000prh.googlegroups.com...
> On May 21, 6:43 pm, "Tibor Karaszi"
> <tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
>> You can run SSMS in "SQLCMD mode" (the Query menu) or use SQLCMD.EXE. If you do this, you can use
>> :r
>> to have the tool to read a file. The file cannot contain GO (batch separator), at lest this was a
>> restriction last time I tested (2000).
>> --
>> Tibor Karaszi, SQL Server
>> MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/tibor_karaszi
>> <benjamin.am...@.gmail.com> wrote in message
>> news:1179731210.026500.253250@.r3g2000prh.googlegroups.com...
>> > On May 21, 4:47 pm, "Tibor Karaszi"
>> > <tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
>> >> What tool are you using to run the script? Also, does the script file exist on the server
>> >> machine
>> >> or
>> >> the client machine?
>> >> --
>> >> Tibor Karaszi, SQL Server
>> >> MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/...
>> >> <benjamin.am...@.gmail.com> wrote in message
>> >>news:1179729481.030659.246610@.n15g2000prd.googlegroups.com...
>> >> > Hi,
>> >> > Is it possible to open a sql file a run the content from another file?
>> >> > MySQL can do it using the "source" function. (http://dev.mysql.com/doc/
>> >> > refman/5.0/en/batch-commands.html).
>> >> > I saw this news
>> >> >http://groups.google.com.au/group/microsoft.public.sqlserver.server/b...
>> >> > but it is not exactly what I want to do.
>> >> > Let me know if it's possible.
>> >> > Thank you.
>> >> > Ben
>> > I'm using the SQL Server Management Studio.
>> > The file will be run on the client machine.
>> > The reason why I'm asking for this function is because we have 300+
>> > SQL script files that need to be ran in a specific order. Opening them
>> > 1 by 1 and running them using the manager is *really* time consuming.
>> > The final script that will run all the others will be used by my
>> > client as a unique "run all" script.
>> > Thank you for your answer.
>> > Ben
> Hi Tibor,
> Thanks for your solution, but I won't be able to us it as most of the
> files are using GO in them. I can't remove this command as the scripts
> are generated by different teams in the company.
> I'll try the solution of TheSQLGuru.
> Ben
>
Open a script file for a script
Hi,
Is it possible to open a sql file a run the content from another file?
MySQL can do it using the "source" function. (http://dev.mysql.com/doc/
refman/5.0/en/batch-commands.html).
I saw this news
0f09197e729ee" target="_blank">http://groups.google.com.au/group/m...
0f09197e729ee
but it is not exactly what I want to do.
Let me know if it's possible.
Thank you.
BenWhat tool are you using to run the script? Also, does the script file exist
on the server machine or
the client machine?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
<benjamin.amiot@.gmail.com> wrote in message
news:1179729481.030659.246610@.n15g2000prd.googlegroups.com...
> Hi,
> Is it possible to open a sql file a run the content from another file?
> mysql can do it using the "source" function. (http://dev.mysql.com/doc/
> refman/5.0/en/batch-commands.html).
> I saw this news
> ea0f09197e729ee" target="_blank">http://groups.google.com.au/group/m...ea0f09197e729ee
> but it is not exactly what I want to do.
> Let me know if it's possible.
> Thank you.
> Ben
>|||On May 21, 4:47 pm, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:[vbcol=seagreen]
> What tool are you using to run the script? Also, does the script file exis
t on the server machine or
> the client machine?
> --
> Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asph
ttp://sqlblog.com/blogs/tibor_karaszi
> <benjamin.am...@.gmail.com> wrote in message
> news:1179729481.030659.246610@.n15g2000prd.googlegroups.com...
>
>
>
>
>
>
>
I'm using the SQL Server Management Studio.
The file will be run on the client machine.
The reason why I'm asking for this function is because we have 300+
SQL script files that need to be ran in a specific order. Opening them
1 by 1 and running them using the manager is *really* time consuming.
The final script that will run all the others will be used by my
client as a unique "run all" script.
Thank you for your answer.
Ben|||You can run SSMS in "SQLCMD mode" (the Query menu) or use SQLCMD.EXE. If you
do this, you can use :r
to have the tool to read a file. The file cannot contain GO (batch separator
), at lest this was a
restriction last time I tested (2000).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
<benjamin.amiot@.gmail.com> wrote in message
news:1179731210.026500.253250@.r3g2000prh.googlegroups.com...
> On May 21, 4:47 pm, "Tibor Karaszi"
> <tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> I'm using the SQL Server Management Studio.
> The file will be run on the client machine.
> The reason why I'm asking for this function is because we have 300+
> SQL script files that need to be ran in a specific order. Opening them
> 1 by 1 and running them using the manager is *really* time consuming.
> The final script that will run all the others will be used by my
> client as a unique "run all" script.
> Thank you for your answer.
> Ben
>|||Since you need to run the 300+ files in a certain order, I would use a
simple vbscript and SMO to do the executes. Use the FileSystemObject to
open each file in the correct order (dos dir /b command output to file will
get you the list of files, which you can then order as appropriate), and
execute against a smo connection to the appropriate server/db.
TheSQLGuru
President
Indicium Resources, Inc.
<benjamin.amiot@.gmail.com> wrote in message
news:1179731210.026500.253250@.r3g2000prh.googlegroups.com...
> On May 21, 4:47 pm, "Tibor Karaszi"
> <tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> I'm using the SQL Server Management Studio.
> The file will be run on the client machine.
> The reason why I'm asking for this function is because we have 300+
> SQL script files that need to be ran in a specific order. Opening them
> 1 by 1 and running them using the manager is *really* time consuming.
> The final script that will run all the others will be used by my
> client as a unique "run all" script.
> Thank you for your answer.
> Ben
>|||On May 22, 4:30 am, "TheSQLGuru" <kgbo...@.earthlink.net> wrote:[vbcol=seagreen]
> Since you need to run the 300+ files in a certain order, I would use a
> simple vbscript and SMO to do the executes. Use the FileSystemObject to
> open each file in the correct order (dos dir /b command output to file wil
l
> get you the list of files, which you can then order as appropriate), and
> execute against a smo connection to the appropriate server/db.
> --
> TheSQLGuru
> President
> Indicium Resources, Inc.
> <benjamin.am...@.gmail.com> wrote in message
> news:1179731210.026500.253250@.r3g2000prh.googlegroups.com...
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
Ok,
I'll try both method and see which one is the easiest to implement.
Thank you for your messages.
Ben|||On May 21, 6:43 pm, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:[vbcol=seagreen]
> You can run SSMS in "SQLCMD mode" (the Query menu) or use SQLCMD.EXE. If y
ou do this, you can use :r
> to have the tool to read a file. The file cannot contain GO (batch separat
or), at lest this was a
> restriction last time I tested (2000).
> --
> Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asph
ttp://sqlblog.com/blogs/tibor_karaszi
> <benjamin.am...@.gmail.com> wrote in message
> news:1179731210.026500.253250@.r3g2000prh.googlegroups.com...
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
Hi Tibor,
Thanks for your solution, but I won't be able to us it as most of the
files are using GO in them. I can't remove this command as the scripts
are generated by different teams in the company.
I'll try the solution of TheSQLGuru.
Ben|||> Thanks for your solution, but I won't be able to us it as most of the
> files are using GO in them. I can't remove this command as the scripts
> are generated by different teams in the company.
This is one of the reasons to always read BOL. Reading current BOL, it seems
like you *can* have
batch terminator in the inner script. Quotes from BOL:
"If the file contains Transact-SQL statements that arenot followed by GO, yo
u must enter GO on the
line that follows :r."
"The file will be read and executed after a batch terminator is encountered.
You can issue multiple
:r commands. The file may include any sqlcmd command. This includes the batc
h terminator GO."
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
<benjamin.amiot@.gmail.com> wrote in message
news:1179790434.126680.210820@.r3g2000prh.googlegroups.com...
> On May 21, 6:43 pm, "Tibor Karaszi"
> <tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> Hi Tibor,
> Thanks for your solution, but I won't be able to us it as most of the
> files are using GO in them. I can't remove this command as the scripts
> are generated by different teams in the company.
> I'll try the solution of TheSQLGuru.
> Ben
>
Is it possible to open a sql file a run the content from another file?
MySQL can do it using the "source" function. (http://dev.mysql.com/doc/
refman/5.0/en/batch-commands.html).
I saw this news
0f09197e729ee" target="_blank">http://groups.google.com.au/group/m...
0f09197e729ee
but it is not exactly what I want to do.
Let me know if it's possible.
Thank you.
BenWhat tool are you using to run the script? Also, does the script file exist
on the server machine or
the client machine?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
<benjamin.amiot@.gmail.com> wrote in message
news:1179729481.030659.246610@.n15g2000prd.googlegroups.com...
> Hi,
> Is it possible to open a sql file a run the content from another file?
> mysql can do it using the "source" function. (http://dev.mysql.com/doc/
> refman/5.0/en/batch-commands.html).
> I saw this news
> ea0f09197e729ee" target="_blank">http://groups.google.com.au/group/m...ea0f09197e729ee
> but it is not exactly what I want to do.
> Let me know if it's possible.
> Thank you.
> Ben
>|||On May 21, 4:47 pm, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:[vbcol=seagreen]
> What tool are you using to run the script? Also, does the script file exis
t on the server machine or
> the client machine?
> --
> Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asph
ttp://sqlblog.com/blogs/tibor_karaszi
> <benjamin.am...@.gmail.com> wrote in message
> news:1179729481.030659.246610@.n15g2000prd.googlegroups.com...
>
>
>
>
>
>
>
I'm using the SQL Server Management Studio.
The file will be run on the client machine.
The reason why I'm asking for this function is because we have 300+
SQL script files that need to be ran in a specific order. Opening them
1 by 1 and running them using the manager is *really* time consuming.
The final script that will run all the others will be used by my
client as a unique "run all" script.
Thank you for your answer.
Ben|||You can run SSMS in "SQLCMD mode" (the Query menu) or use SQLCMD.EXE. If you
do this, you can use :r
to have the tool to read a file. The file cannot contain GO (batch separator
), at lest this was a
restriction last time I tested (2000).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
<benjamin.amiot@.gmail.com> wrote in message
news:1179731210.026500.253250@.r3g2000prh.googlegroups.com...
> On May 21, 4:47 pm, "Tibor Karaszi"
> <tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> I'm using the SQL Server Management Studio.
> The file will be run on the client machine.
> The reason why I'm asking for this function is because we have 300+
> SQL script files that need to be ran in a specific order. Opening them
> 1 by 1 and running them using the manager is *really* time consuming.
> The final script that will run all the others will be used by my
> client as a unique "run all" script.
> Thank you for your answer.
> Ben
>|||Since you need to run the 300+ files in a certain order, I would use a
simple vbscript and SMO to do the executes. Use the FileSystemObject to
open each file in the correct order (dos dir /b command output to file will
get you the list of files, which you can then order as appropriate), and
execute against a smo connection to the appropriate server/db.
TheSQLGuru
President
Indicium Resources, Inc.
<benjamin.amiot@.gmail.com> wrote in message
news:1179731210.026500.253250@.r3g2000prh.googlegroups.com...
> On May 21, 4:47 pm, "Tibor Karaszi"
> <tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> I'm using the SQL Server Management Studio.
> The file will be run on the client machine.
> The reason why I'm asking for this function is because we have 300+
> SQL script files that need to be ran in a specific order. Opening them
> 1 by 1 and running them using the manager is *really* time consuming.
> The final script that will run all the others will be used by my
> client as a unique "run all" script.
> Thank you for your answer.
> Ben
>|||On May 22, 4:30 am, "TheSQLGuru" <kgbo...@.earthlink.net> wrote:[vbcol=seagreen]
> Since you need to run the 300+ files in a certain order, I would use a
> simple vbscript and SMO to do the executes. Use the FileSystemObject to
> open each file in the correct order (dos dir /b command output to file wil
l
> get you the list of files, which you can then order as appropriate), and
> execute against a smo connection to the appropriate server/db.
> --
> TheSQLGuru
> President
> Indicium Resources, Inc.
> <benjamin.am...@.gmail.com> wrote in message
> news:1179731210.026500.253250@.r3g2000prh.googlegroups.com...
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
Ok,
I'll try both method and see which one is the easiest to implement.
Thank you for your messages.
Ben|||On May 21, 6:43 pm, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:[vbcol=seagreen]
> You can run SSMS in "SQLCMD mode" (the Query menu) or use SQLCMD.EXE. If y
ou do this, you can use :r
> to have the tool to read a file. The file cannot contain GO (batch separat
or), at lest this was a
> restriction last time I tested (2000).
> --
> Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asph
ttp://sqlblog.com/blogs/tibor_karaszi
> <benjamin.am...@.gmail.com> wrote in message
> news:1179731210.026500.253250@.r3g2000prh.googlegroups.com...
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
Hi Tibor,
Thanks for your solution, but I won't be able to us it as most of the
files are using GO in them. I can't remove this command as the scripts
are generated by different teams in the company.
I'll try the solution of TheSQLGuru.
Ben|||> Thanks for your solution, but I won't be able to us it as most of the
> files are using GO in them. I can't remove this command as the scripts
> are generated by different teams in the company.
This is one of the reasons to always read BOL. Reading current BOL, it seems
like you *can* have
batch terminator in the inner script. Quotes from BOL:
"If the file contains Transact-SQL statements that arenot followed by GO, yo
u must enter GO on the
line that follows :r."
"The file will be read and executed after a batch terminator is encountered.
You can issue multiple
:r commands. The file may include any sqlcmd command. This includes the batc
h terminator GO."
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
<benjamin.amiot@.gmail.com> wrote in message
news:1179790434.126680.210820@.r3g2000prh.googlegroups.com...
> On May 21, 6:43 pm, "Tibor Karaszi"
> <tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> Hi Tibor,
> Thanks for your solution, but I won't be able to us it as most of the
> files are using GO in them. I can't remove this command as the scripts
> are generated by different teams in the company.
> I'll try the solution of TheSQLGuru.
> Ben
>
Subscribe to:
Posts (Atom)