Showing posts with label program. Show all posts
Showing posts with label program. Show all posts

Friday, March 30, 2012

running and exporting report using visual basic 6.0 (not using .net)

Hello,
I saw the post below that it is possible if we develop programs with C# or
VB.NET.
My question is
Is it possible to develop the program using visual basic 6.0?
If so, which reporting services dll should be referenced in visual basic 6.0
project?
Could you explain in detail what to do in visual studio IDE environment?
Thanks in advance,
StpnK
<<copied from the previous posts>>
>Yes, Reporting Services provide a set of Web Services API that you can call
>to generate report. Form your client app project (Win Form App), set web
>reference to the reporting services and look into its Render() methods. You
>can also learn more aboubt this from SQL Server2005 Book on Line.
>
"Smugliy" <Smugliy@.discussions.microsoft.com> wrote in message
news:184E2D63-E618-4C35-A0C5-5F3A647B3803@.microsoft.com...
> Hello ,All
> I am new to the reporting services and my question maybe stupid .
>
> I created some report and published it on the server.
> Now my question is : does it possible at all to run this report from my
> client (in C# )and to export the result to CSV format also from client
> Is there any web service that I can use which is calling for my report
> ?
> Please ,help me to understand this .
> Thanks a lot.
> Smugliy
>
>
>You would have to use the soap toolkit and do lots and lots of roll your own
coding. And even then there might be some incompatibilities.
Your best bet is to use URL integration. This is very straight forward and
easy to implement. Generate the URL string, embed the IE browser control (if
all you want to do is show the report) and set the url for the control.
There are lots of examples on the web of how to embed the browser control
and set the URL.
Books online has lots of examples of URL integration.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"stpnK" <ssdfatepano917@.optonline.net> wrote in message
news:47f3122d$0$15166$607ed4bc@.cv.net...
> Hello,
> I saw the post below that it is possible if we develop programs with C# or
> VB.NET.
> My question is
> Is it possible to develop the program using visual basic 6.0?
> If so, which reporting services dll should be referenced in visual basic
> 6.0 project?
> Could you explain in detail what to do in visual studio IDE environment?
> Thanks in advance,
> StpnK
> <<copied from the previous posts>>
>>Yes, Reporting Services provide a set of Web Services API that you can
>>call
>>to generate report. Form your client app project (Win Form App), set web
>>reference to the reporting services and look into its Render() methods.
>>You
>>can also learn more aboubt this from SQL Server2005 Book on Line.
> "Smugliy" <Smugliy@.discussions.microsoft.com> wrote in message
> news:184E2D63-E618-4C35-A0C5-5F3A647B3803@.microsoft.com...
>> Hello ,All
>> I am new to the reporting services and my question maybe stupid .
>> I created some report and published it on the server.
>> Now my question is : does it possible at all to run this report from my
>> client (in C# )and to export the result to CSV format also from client
>> Is there any web service that I can use which is calling for my report
>> ?
>> Please ,help me to understand this .
>> Thanks a lot.
>> Smugliy
>>
>
>|||Thanks for your reply. Bruce.
Let me explain details.
I have a VB6 program (A.EXE) keeping running on the server. This program
should do lots of things such as monitoring the incoming files, reading the
files and do various kinds of tasks depending on the file type and other
conditions on the file...
With certain type of files, this program needs to call report-generator
(dll) (this is the program I want to write) of SSRS 2005 (passing
parameters) so that the report-generator saves the output file as PDF format
on the network folder. After that this program picks up this PDF file and
send emails to the customer with PDF reports attachments.
So to speak, there is no user interaction, no report viewer required...
(1) Is it doable with vb6.0 projects (possibly connecting to SSRS without
user interaction)?
If so, can you tell me the sample URL site? or attach the sample?
(2) I think it is doable with C#.NET or VB.NET...
Can you introduce the URL of samples? Or attach the sample if you have any?
Best Regards,
stpnK
"Bruce L-C [MVP]" <bruce_lcNOSPAM@.hotmail.com> wrote in message
news:ul0WYuNlIHA.1184@.TK2MSFTNGP04.phx.gbl...
> You would have to use the soap toolkit and do lots and lots of roll your
> own coding. And even then there might be some incompatibilities.
> Your best bet is to use URL integration. This is very straight forward and
> easy to implement. Generate the URL string, embed the IE browser control
> (if all you want to do is show the report) and set the url for the
> control. There are lots of examples on the web of how to embed the browser
> control and set the URL.
> Books online has lots of examples of URL integration.
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "stpnK" <ssdfatepano917@.optonline.net> wrote in message
> news:47f3122d$0$15166$607ed4bc@.cv.net...
>> Hello,
>> I saw the post below that it is possible if we develop programs with C#
>> or VB.NET.
>> My question is
>> Is it possible to develop the program using visual basic 6.0?
>> If so, which reporting services dll should be referenced in visual basic
>> 6.0 project?
>> Could you explain in detail what to do in visual studio IDE environment?
>> Thanks in advance,
>> StpnK
>> <<copied from the previous posts>>
>>Yes, Reporting Services provide a set of Web Services API that you can
>>call
>>to generate report. Form your client app project (Win Form App), set web
>>reference to the reporting services and look into its Render() methods.
>>You
>>can also learn more aboubt this from SQL Server2005 Book on Line.
>>
>> "Smugliy" <Smugliy@.discussions.microsoft.com> wrote in message
>> news:184E2D63-E618-4C35-A0C5-5F3A647B3803@.microsoft.com...
>> Hello ,All
>> I am new to the reporting services and my question maybe stupid .
>> I created some report and published it on the server.
>> Now my question is : does it possible at all to run this report from my
>> client (in C# )and to export the result to CSV format also from client
>> Is there any web service that I can use which is calling for my report
>> ?
>> Please ,help me to understand this .
>> Thanks a lot.
>> Smugliy
>>
>>
>>
>|||I use the URL method in two ways. One, I have used it for integrating in old
type of programs. For instance, we use In-Touch a real time MMI (in the real
time control world the environment that interacts with the user is called
MMI, man machine interface). For that I embed a browser control. However, in
your case you have no GUI and so you would need to go to a lower level,
getting some dll that will go to a website and then get the stream back and
do with it as you will. Personally I think this is going to be a mess.
I think a vb.net or c# program using web services would be a much better way
to go that using URL and VB6.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"stpnK" <ssdfatepano917@.optonline.net> wrote in message
news:47f6b3df$0$15199$607ed4bc@.cv.net...
> Thanks for your reply. Bruce.
> Let me explain details.
> I have a VB6 program (A.EXE) keeping running on the server. This program
> should do lots of things such as monitoring the incoming files, reading
> the
> files and do various kinds of tasks depending on the file type and other
> conditions on the file...
> With certain type of files, this program needs to call report-generator
> (dll) (this is the program I want to write) of SSRS 2005 (passing
> parameters) so that the report-generator saves the output file as PDF
> format
> on the network folder. After that this program picks up this PDF file and
> send emails to the customer with PDF reports attachments.
> So to speak, there is no user interaction, no report viewer required...
> (1) Is it doable with vb6.0 projects (possibly connecting to SSRS without
> user interaction)?
> If so, can you tell me the sample URL site? or attach the sample?
> (2) I think it is doable with C#.NET or VB.NET...
> Can you introduce the URL of samples? Or attach the sample if you have
> any?
> Best Regards,
> stpnK
>
> "Bruce L-C [MVP]" <bruce_lcNOSPAM@.hotmail.com> wrote in message
> news:ul0WYuNlIHA.1184@.TK2MSFTNGP04.phx.gbl...
>> You would have to use the soap toolkit and do lots and lots of roll your
>> own coding. And even then there might be some incompatibilities.
>> Your best bet is to use URL integration. This is very straight forward
>> and easy to implement. Generate the URL string, embed the IE browser
>> control (if all you want to do is show the report) and set the url for
>> the control. There are lots of examples on the web of how to embed the
>> browser control and set the URL.
>> Books online has lots of examples of URL integration.
>>
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>> "stpnK" <ssdfatepano917@.optonline.net> wrote in message
>> news:47f3122d$0$15166$607ed4bc@.cv.net...
>> Hello,
>> I saw the post below that it is possible if we develop programs with C#
>> or VB.NET.
>> My question is
>> Is it possible to develop the program using visual basic 6.0?
>> If so, which reporting services dll should be referenced in visual basic
>> 6.0 project?
>> Could you explain in detail what to do in visual studio IDE environment?
>> Thanks in advance,
>> StpnK
>> <<copied from the previous posts>>
>>Yes, Reporting Services provide a set of Web Services API that you can
>>call
>>to generate report. Form your client app project (Win Form App), set web
>>reference to the reporting services and look into its Render() methods.
>>You
>>can also learn more aboubt this from SQL Server2005 Book on Line.
>>
>> "Smugliy" <Smugliy@.discussions.microsoft.com> wrote in message
>> news:184E2D63-E618-4C35-A0C5-5F3A647B3803@.microsoft.com...
>> Hello ,All
>> I am new to the reporting services and my question maybe stupid .
>> I created some report and published it on the server.
>> Now my question is : does it possible at all to run this report from my
>> client (in C# )and to export the result to CSV format also from client
>> Is there any web service that I can use which is calling for my
>> report
>> ?
>> Please ,help me to understand this .
>> Thanks a lot.
>> Smugliy
>>
>>
>>
>>
>

running an exe file SQL server agent

Hi ,
I have an exe program that i do not want to be part of
the services however , i do want it to auto-start when the
server is rebooted.
it is possble to configure it as part of SQL server
Agent job ?
thks & rdgs
maxzism,
Whilst it is possible, it may not necessarily be desirable. What exactly
are you trying to do? Using the Startup folder in windows, or using the
'at' command, or some other software may be a better option.
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
maxzsim wrote:
> Hi ,
>
> I have an exe program that i do not want to be part of
> the services however , i do want it to auto-start when the
> server is rebooted.
> it is possble to configure it as part of SQL server
> Agent job ?
>
> thks & rdgs

running an exe file SQL server agent

Hi ,
I have an exe program that i do not want to be part of
the services however , i do want it to auto-start when the
server is rebooted.
it is possble to configure it as part of SQL server
Agent job ?
thks & rdgsmaxzism,
Whilst it is possible, it may not necessarily be desirable. What exactly
are you trying to do? Using the Startup folder in windows, or using the
'at' command, or some other software may be a better option.
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
maxzsim wrote:
> Hi ,
>
> I have an exe program that i do not want to be part of
> the services however , i do want it to auto-start when the
> server is rebooted.
> it is possble to configure it as part of SQL server
> Agent job ?
>
> thks & rdgs

running an exe file SQL server agent

Hi ,
I have an exe program that i do not want to be part of
the services however , i do want it to auto-start when the
server is rebooted.
it is possble to configure it as part of SQL server
Agent job ?
thks & rdgsYes,
Look up the xp_cmdshell command, and the SQL Agent 'Start
up Automatically when SQL Agent Starts' in schedule.
Peter
>--Original Message--
>Hi ,
>
> I have an exe program that i do not want to be part of
>the services however , i do want it to auto-start when
the
>server is rebooted.
> it is possble to configure it as part of SQL server
>Agent job ?
>
>thks & rdgs
>.
>|||maxzism,
Whilst it is possible, it may not necessarily be desirable. What exactly
are you trying to do? Using the Startup folder in windows, or using the
'at' command, or some other software may be a better option.
--
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
maxzsim wrote:
> Hi ,
>
> I have an exe program that i do not want to be part of
> the services however , i do want it to auto-start when the
> server is rebooted.
> it is possble to configure it as part of SQL server
> Agent job ?
>
> thks & rdgs|||hi,
thks for ur info , i think it has solved my problem
rdgs
>--Original Message--
>Yes,
>Look up the xp_cmdshell command, and the SQL Agent 'Start
>up Automatically when SQL Agent Starts' in schedule.
>Peter
>>--Original Message--
>>Hi ,
>>
>> I have an exe program that i do not want to be part
of
>>the services however , i do want it to auto-start when
>the
>>server is rebooted.
>> it is possble to configure it as part of SQL server
>>Agent job ?
>>
>>thks & rdgs
>>.
>.
>

Wednesday, March 28, 2012

Running a SQL file from OSQL command line utility

Hi,

I have dumped a very large database from mysql (using mysqldump program)
as a raw sql file. The reason was, convert this database to a MSSQL
database. Since mysqldump creates the file as raw sql file with the
database-table structures and the data in it, I thought using OSQL command
line utilities should work to out this whole database in MSSQL server.

I have run this command from command line:

osql -u sa -i mysqldump.sql

It is going since yesterday. It has been almost 36 hours that it's
started. And in the mssql server, I see no database created yet. On the
screen of the command line, I see bunch of numbers are going in order. I
assume they are row numbers of the tables processed. But, if it is doing it,
then where is it saving all this data ? I have checked the tempdb, pub db,
other dbs, and I see no tables related to the database I am inserting. Will
it populate it at the and of the job ? Or, am I doing something wrong here
?

Regards.

Murtix.Hi ,

You cant use that file (generated using MYSQLDUMP) directly in MSSQL using
OSQL. This raw file can be used only in MYSQL incase you need a recovary.
OSQL program can take only TSQL commands.

The solution for you is:

1. Create a database in MSSQL server Manually
2. Use DTS to transfer Tables to MSSQL Server

If your table size is very huge , generate a text file in MYSQL for each
tables and use BCP IN to load inside MSSQL.

Thanks
Hari
MCDBA

"Murtix Van Basten" <nospam@.nospam.org> wrote in message
news:3fee42a7$1_3@.athenanews.com...
> Hi,
> I have dumped a very large database from mysql (using mysqldump
program)
> as a raw sql file. The reason was, convert this database to a MSSQL
> database. Since mysqldump creates the file as raw sql file with the
> database-table structures and the data in it, I thought using OSQL command
> line utilities should work to out this whole database in MSSQL server.
> I have run this command from command line:
> osql -u sa -i mysqldump.sql
> It is going since yesterday. It has been almost 36 hours that it's
> started. And in the mssql server, I see no database created yet. On the
> screen of the command line, I see bunch of numbers are going in order. I
> assume they are row numbers of the tables processed. But, if it is doing
it,
> then where is it saving all this data ? I have checked the tempdb, pub db,
> other dbs, and I see no tables related to the database I am inserting.
Will
> it populate it at the and of the job ? Or, am I doing something wrong
here
> ?
> Regards.
> Murtix.|||Hi Hari,

all the pain I suffered to do this, was because of not to use BCP method.
I guess I will have to use it after finding out osql methid would not work.

Thank you clearifying this issue for me.

Best Regards.

Murtix.

"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:Oaj1x2OzDHA.1412@.TK2MSFTNGP11.phx.gbl...
> Hi ,
> You cant use that file (generated using MYSQLDUMP) directly in MSSQL using
> OSQL. This raw file can be used only in MYSQL incase you need a recovary.
> OSQL program can take only TSQL commands.
> The solution for you is:
> 1. Create a database in MSSQL server Manually
> 2. Use DTS to transfer Tables to MSSQL Server
> If your table size is very huge , generate a text file in MYSQL for each
> tables and use BCP IN to load inside MSSQL.
> Thanks
> Hari
> MCDBA
>
>
>
> "Murtix Van Basten" <nospam@.nospam.org> wrote in message
> news:3fee42a7$1_3@.athenanews.com...
> > Hi,
> > I have dumped a very large database from mysql (using mysqldump
> program)
> > as a raw sql file. The reason was, convert this database to a MSSQL
> > database. Since mysqldump creates the file as raw sql file with the
> > database-table structures and the data in it, I thought using OSQL
command
> > line utilities should work to out this whole database in MSSQL server.
> > I have run this command from command line:
> > osql -u sa -i mysqldump.sql
> > It is going since yesterday. It has been almost 36 hours that it's
> > started. And in the mssql server, I see no database created yet. On the
> > screen of the command line, I see bunch of numbers are going in order. I
> > assume they are row numbers of the tables processed. But, if it is doing
> it,
> > then where is it saving all this data ? I have checked the tempdb, pub
db,
> > other dbs, and I see no tables related to the database I am inserting.
> Will
> > it populate it at the and of the job ? Or, am I doing something wrong
> here
> > ?
> > Regards.
> > Murtix.

Running a SQL file from OSQL command line utility

Hi,
I have dumped a very large database from mysql (using mysqldump program)
as a raw sql file. The reason was, convert this database to a MSSQL
database. Since mysqldump creates the file as raw sql file with the
database-table structures and the data in it, I thought using OSQL command
line utilities should work to out this whole database in MSSQL server.
I have run this command from command line:
osql -u sa -i mysqldump.sql
It is going since yesterday. It has been almost 36 hours that it's
started. And in the mssql server, I see no database created yet. On the
screen of the command line, I see bunch of numbers are going in order. I
assume they are row numbers of the tables processed. But, if it is doing it,
then where is it saving all this data ? I have checked the tempdb, pub db,
other dbs, and I see no tables related to the database I am inserting. Will
it populate it at the and of the job ? Or, am I doing something wrong here
?
Regards.
Murtix.Hi Murtix
You cannot load into SQL Server anything other than a SQL Server backup.
Is mysqldump the actual backup file? If so, then what you are seeing in the
line number is osql thinking it is receiving a command, and it keep
receiving them, waiting to receive a 'go' to tell it to execute what it has
received. It will not even try to process whatever bits are in the mysqldump
file until it finally encounters a 'go'.
The contents of an input file passed to osql (with -i) needs to be a SQL
script, containing valid Transact-SQL statements. Even if you had a valid
SQL Server backup file, the input file to osql would have to be script in
the TSQL language telling SQL Server to restore a specified backup file, you
could not just pass in the backup file itself.
--
HTH
--
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"Murtix Van Basten" <nospam@.nospam.org> wrote in message
news:3fee42a7$1_3@.athenanews.com...
> Hi,
> I have dumped a very large database from mysql (using mysqldump
program)
> as a raw sql file. The reason was, convert this database to a MSSQL
> database. Since mysqldump creates the file as raw sql file with the
> database-table structures and the data in it, I thought using OSQL command
> line utilities should work to out this whole database in MSSQL server.
> I have run this command from command line:
> osql -u sa -i mysqldump.sql
> It is going since yesterday. It has been almost 36 hours that it's
> started. And in the mssql server, I see no database created yet. On the
> screen of the command line, I see bunch of numbers are going in order. I
> assume they are row numbers of the tables processed. But, if it is doing
it,
> then where is it saving all this data ? I have checked the tempdb, pub db,
> other dbs, and I see no tables related to the database I am inserting.
Will
> it populate it at the and of the job ? Or, am I doing something wrong
here
> ?
> Regards.
> Murtix.
>|||Hi ,
You cant use that file (generated using MYSQLDUMP) directly in MSSQL using
OSQL. This raw file can be used only in MYSQL incase you need a recovary.
OSQL program can take only TSQL commands.
The solution for you is:
1. Create a database in MSSQL server Manually
2. Use DTS to transfer Tables to MSSQL Server
If your table size is very huge , generate a text file in MYSQL for each
tables and use BCP IN to load inside MSSQL.
Thanks
Hari
MCDBA
"Murtix Van Basten" <nospam@.nospam.org> wrote in message
news:3fee42a7$1_3@.athenanews.com...
> Hi,
> I have dumped a very large database from mysql (using mysqldump
program)
> as a raw sql file. The reason was, convert this database to a MSSQL
> database. Since mysqldump creates the file as raw sql file with the
> database-table structures and the data in it, I thought using OSQL command
> line utilities should work to out this whole database in MSSQL server.
> I have run this command from command line:
> osql -u sa -i mysqldump.sql
> It is going since yesterday. It has been almost 36 hours that it's
> started. And in the mssql server, I see no database created yet. On the
> screen of the command line, I see bunch of numbers are going in order. I
> assume they are row numbers of the tables processed. But, if it is doing
it,
> then where is it saving all this data ? I have checked the tempdb, pub db,
> other dbs, and I see no tables related to the database I am inserting.
Will
> it populate it at the and of the job ? Or, am I doing something wrong
here
> ?
> Regards.
> Murtix.
>|||I see.
Thanks.
It is a mysqldump file so, there is not any t-sql scripts in it. (AFAIK
T-SQL is only being used by MSSQL, and I dont think mysql could create a
raw-sql file in that format) That means I have been doing nothing :-(.
But just of a curiosity. what is the numbers I am seeing on the screen
though ? I mean, could you tell me what is the computer processing now ?
Murtix.
"Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
news:eqe$00OzDHA.1676@.TK2MSFTNGP12.phx.gbl...
> Hi Murtix
> You cannot load into SQL Server anything other than a SQL Server backup.
> Is mysqldump the actual backup file? If so, then what you are seeing in
the
> line number is osql thinking it is receiving a command, and it keep
> receiving them, waiting to receive a 'go' to tell it to execute what it
has
> received. It will not even try to process whatever bits are in the
mysqldump
> file until it finally encounters a 'go'.
> The contents of an input file passed to osql (with -i) needs to be a SQL
> script, containing valid Transact-SQL statements. Even if you had a valid
> SQL Server backup file, the input file to osql would have to be script in
> the TSQL language telling SQL Server to restore a specified backup file,
you
> could not just pass in the backup file itself.
> --
> HTH
> --
> Kalen Delaney
> SQL Server MVP
> www.SolidQualityLearning.com
>
> "Murtix Van Basten" <nospam@.nospam.org> wrote in message
> news:3fee42a7$1_3@.athenanews.com...
> > Hi,
> >
> > I have dumped a very large database from mysql (using mysqldump
> program)
> > as a raw sql file. The reason was, convert this database to a MSSQL
> > database. Since mysqldump creates the file as raw sql file with the
> > database-table structures and the data in it, I thought using OSQL
command
> > line utilities should work to out this whole database in MSSQL server.
> >
> > I have run this command from command line:
> >
> > osql -u sa -i mysqldump.sql
> >
> > It is going since yesterday. It has been almost 36 hours that it's
> > started. And in the mssql server, I see no database created yet. On the
> > screen of the command line, I see bunch of numbers are going in order. I
> > assume they are row numbers of the tables processed. But, if it is doing
> it,
> > then where is it saving all this data ? I have checked the tempdb, pub
db,
> > other dbs, and I see no tables related to the database I am inserting.
> Will
> > it populate it at the and of the job ? Or, am I doing something wrong
> here
> > ?
> >
> > Regards.
> >
> > Murtix.
> >
> >
>|||Hi Hari,
all the pain I suffered to do this, was because of not to use BCP method.
I guess I will have to use it after finding out osql methid would not work.
Thank you clearifying this issue for me.
Best Regards.
Murtix.
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:Oaj1x2OzDHA.1412@.TK2MSFTNGP11.phx.gbl...
> Hi ,
> You cant use that file (generated using MYSQLDUMP) directly in MSSQL using
> OSQL. This raw file can be used only in MYSQL incase you need a recovary.
> OSQL program can take only TSQL commands.
> The solution for you is:
> 1. Create a database in MSSQL server Manually
> 2. Use DTS to transfer Tables to MSSQL Server
> If your table size is very huge , generate a text file in MYSQL for each
> tables and use BCP IN to load inside MSSQL.
> Thanks
> Hari
> MCDBA
>
>
>
> "Murtix Van Basten" <nospam@.nospam.org> wrote in message
> news:3fee42a7$1_3@.athenanews.com...
> > Hi,
> >
> > I have dumped a very large database from mysql (using mysqldump
> program)
> > as a raw sql file. The reason was, convert this database to a MSSQL
> > database. Since mysqldump creates the file as raw sql file with the
> > database-table structures and the data in it, I thought using OSQL
command
> > line utilities should work to out this whole database in MSSQL server.
> >
> > I have run this command from command line:
> >
> > osql -u sa -i mysqldump.sql
> >
> > It is going since yesterday. It has been almost 36 hours that it's
> > started. And in the mssql server, I see no database created yet. On the
> > screen of the command line, I see bunch of numbers are going in order. I
> > assume they are row numbers of the tables processed. But, if it is doing
> it,
> > then where is it saving all this data ? I have checked the tempdb, pub
db,
> > other dbs, and I see no tables related to the database I am inserting.
> Will
> > it populate it at the and of the job ? Or, am I doing something wrong
> here
> > ?
> >
> > Regards.
> >
> > Murtix.
> >
> >
>|||Murtix,
> It is a mysqldump file so, there is not any t-sql scripts in it.
> (AFAIK T-SQL is only being used by MSSQL, and I dont think mysql
> could create a raw-sql file in that format) That means I have
> been doing nothing :-(.
Please take a look at this product. It is probably the best solution
for your problem. You can download the evaluation version.
http://www.ispirer.com/products/
> But just of a curiosity. what is the numbers I am seeing on the
> screen though ? I mean, could you tell me what is the computer
> processing now ?
As Kalen said, osql is trying to interpret the file as a series of
T-SQL statements. The numbers you see are line numbers of "lines"
that osql has parsed. They can be suppressed wih the -n command line
switch.
Linda|||Hi Murtix
What exactly do you mean by 'raw' sql file? SQL is a language, so the only
thing I can think of 'raw' SQL meaning is a file of ANSI standard SQL
commands.
--
HTH
--
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"Murtix Van Basten" <nospam@.nospam.org> wrote in message
news:3fee4677$1_1@.athenanews.com...
> I see.
> Thanks.
> It is a mysqldump file so, there is not any t-sql scripts in it. (AFAIK
> T-SQL is only being used by MSSQL, and I dont think mysql could create a
> raw-sql file in that format) That means I have been doing nothing :-(.
> But just of a curiosity. what is the numbers I am seeing on the screen
> though ? I mean, could you tell me what is the computer processing now ?
> Murtix.
> "Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
> news:eqe$00OzDHA.1676@.TK2MSFTNGP12.phx.gbl...
> > Hi Murtix
> >
> > You cannot load into SQL Server anything other than a SQL Server backup.
> >
> > Is mysqldump the actual backup file? If so, then what you are seeing in
> the
> > line number is osql thinking it is receiving a command, and it keep
> > receiving them, waiting to receive a 'go' to tell it to execute what it
> has
> > received. It will not even try to process whatever bits are in the
> mysqldump
> > file until it finally encounters a 'go'.
> >
> > The contents of an input file passed to osql (with -i) needs to be a SQL
> > script, containing valid Transact-SQL statements. Even if you had a
valid
> > SQL Server backup file, the input file to osql would have to be script
in
> > the TSQL language telling SQL Server to restore a specified backup file,
> you
> > could not just pass in the backup file itself.
> >
> > --
> > HTH
> > --
> > Kalen Delaney
> > SQL Server MVP
> > www.SolidQualityLearning.com
> >
> >
> > "Murtix Van Basten" <nospam@.nospam.org> wrote in message
> > news:3fee42a7$1_3@.athenanews.com...
> > > Hi,
> > >
> > > I have dumped a very large database from mysql (using mysqldump
> > program)
> > > as a raw sql file. The reason was, convert this database to a MSSQL
> > > database. Since mysqldump creates the file as raw sql file with the
> > > database-table structures and the data in it, I thought using OSQL
> command
> > > line utilities should work to out this whole database in MSSQL server.
> > >
> > > I have run this command from command line:
> > >
> > > osql -u sa -i mysqldump.sql
> > >
> > > It is going since yesterday. It has been almost 36 hours that it's
> > > started. And in the mssql server, I see no database created yet. On
the
> > > screen of the command line, I see bunch of numbers are going in order.
I
> > > assume they are row numbers of the tables processed. But, if it is
doing
> > it,
> > > then where is it saving all this data ? I have checked the tempdb, pub
> db,
> > > other dbs, and I see no tables related to the database I am inserting.
> > Will
> > > it populate it at the and of the job ? Or, am I doing something wrong
> > here
> > > ?
> > >
> > > Regards.
> > >
> > > Murtix.
> > >
> > >
> >
> >
>|||Murtix Van Basten (nospam@.nospam.org) writes:
> It is a mysqldump file so, there is not any t-sql scripts in it. (AFAIK
> T-SQL is only being used by MSSQL, and I dont think mysql could create a
> raw-sql file in that format) That means I have been doing nothing :-(.
> But just of a curiosity. what is the numbers I am seeing on the screen
> though ? I mean, could you tell me what is the computer processing now ?
OSQL is also intended to be a interactive utility, so when you start
OSQL without the -i switch, you can enter commands. The 1>, 2> etc are
the command prompts, one per line. As Linda said, you can use -n to
suppress these. You can also use -o to redirect output to a file, so
you can look at the error messages.
However, since MySQL is not like to generate SQL suitable for MS SQL Server,
the whole operation appears to be a fruitless one. You could possibly use
the file, but you would have to edit it manually to address changes
between the SQL dialects and to insert GO statements to separate
batches.
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp

Running a program from a SQL job

Hi
I'm having a strange problem which puzzels me a little bit.
I have created a SQL job that can zip a file that has been generated from a
provious job. I've made a bat file that contains the string to run to zip
the file. When I run this bat file manually just by doubleclicking it, it
runs fine and do the job. When I set the SQL job to execute the same bat
file, it executes the bat file, but the bat file doesn't zip the file. It
reports that everything is ok, but the file isn't being created.
It seems like the zip program I've found that can be executed from a command
line (it's a program called 7-zip) will only do the job if it can "open" a
command prompt in the background which SQL apparently doesn't do.
My question is now if any of you know a way to let a SQL job "open" a
command prompt and then execute a program from there. It could also be as
simple as using a different zip program. 7-zip was just one I found that
could zip a file from a command line.
Regards
Steen
Hi,
Use XP_CMDSHELL to fire a OS command from command prompt.
Before commentng more, can you send out the script you are trying out.
Thanks
Hari
MCDBA
"Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
news:uKWljChUEHA.1764@.TK2MSFTNGP10.phx.gbl...
> Hi
> I'm having a strange problem which puzzels me a little bit.
> I have created a SQL job that can zip a file that has been generated from
a
> provious job. I've made a bat file that contains the string to run to zip
> the file. When I run this bat file manually just by doubleclicking it, it
> runs fine and do the job. When I set the SQL job to execute the same bat
> file, it executes the bat file, but the bat file doesn't zip the file. It
> reports that everything is ok, but the file isn't being created.
> It seems like the zip program I've found that can be executed from a
command
> line (it's a program called 7-zip) will only do the job if it can "open" a
> command prompt in the background which SQL apparently doesn't do.
> My question is now if any of you know a way to let a SQL job "open" a
> command prompt and then execute a program from there. It could also be as
> simple as using a different zip program. 7-zip was just one I found that
> could zip a file from a command line.
> Regards
> Steen
>
|||Hi Hari
Thanks for the advise. I've just tried it, but it seems like it has the same
problem as when I run it un a job.
The commandline I'm running is : "c:\program files\7-zip\7z" a -tzip
filename.zip filename.mdc
This works fine when running it either as a bat file or just in a cmd
window, but from within SQL it seems to fail. The output I get from running
it either as a job or with the XP_CmdShell is :
NULL
7-Zip 2.30 Beta 28 Copyright (c) 1999-2003 Igor Pavlov 2003-02-16
Scanning
NULL
Updating archive filename.zip
NULL
NULL
Everything is Ok
NULL
It reports that everything is ok, but it just don't create the zip file. It
might be that this 7-zip program just can't run properly without having an
open cmd prompt - which of course is a bit weird.
Regards
Steen
"Hari" <hari_prasad_k@.hotmail.com> skrev i en meddelelse
news:eCrlkGhUEHA.484@.TK2MSFTNGP10.phx.gbl...[vbcol=seagreen]
> Hi,
> Use XP_CMDSHELL to fire a OS command from command prompt.
> Before commentng more, can you send out the script you are trying out.
> --
> Thanks
> Hari
> MCDBA
> "Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
> news:uKWljChUEHA.1764@.TK2MSFTNGP10.phx.gbl...
from[vbcol=seagreen]
> a
zip[vbcol=seagreen]
it[vbcol=seagreen]
It[vbcol=seagreen]
> command
a[vbcol=seagreen]
as
>
|||Hi,
Login to SQL server from command prompt:-
OSQL -Usa -Ppassword -S SQl_server
This will allow you to go to a SQL prompt:-
1>
Here you execute the xp_cmdshell
1>master..xp_cmdsehll 'c:\program files\7-zip\7z a -tzip'
2>go
Note:
Please use the syntax clearly
Thanks
Hari
MCDBA
"Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
news:uPWCBNhUEHA.3988@.tk2msftngp13.phx.gbl...
> Hi Hari
> Thanks for the advise. I've just tried it, but it seems like it has the
same
> problem as when I run it un a job.
> The commandline I'm running is : "c:\program files\7-zip\7z" a -tzip
> filename.zip filename.mdc
> This works fine when running it either as a bat file or just in a cmd
> window, but from within SQL it seems to fail. The output I get from
running
> it either as a job or with the XP_CmdShell is :
> NULL
> 7-Zip 2.30 Beta 28 Copyright (c) 1999-2003 Igor Pavlov 2003-02-16
> Scanning
> NULL
> Updating archive filename.zip
> NULL
> NULL
> Everything is Ok
> NULL
> It reports that everything is ok, but it just don't create the zip file.
It[vbcol=seagreen]
> might be that this 7-zip program just can't run properly without having an
> open cmd prompt - which of course is a bit weird.
> Regards
> Steen
>
>
> "Hari" <hari_prasad_k@.hotmail.com> skrev i en meddelelse
> news:eCrlkGhUEHA.484@.TK2MSFTNGP10.phx.gbl...
> from
> zip
> it
bat[vbcol=seagreen]
> It
"open"[vbcol=seagreen]
> a
> as
that
>
|||Hi Hari
Thansk for your suggestions, but it simply won't do it. I get the same
result when running is with the Osql command. Apparently this zip program
only works when it's launched from it's "own" cmd prompt.
Steen
"Hari" <hari_prasad_k@.hotmail.com> skrev i en meddelelse
news:%23zI$HThUEHA.1020@.TK2MSFTNGP11.phx.gbl...[vbcol=seagreen]
> Hi,
> Login to SQL server from command prompt:-
> OSQL -Usa -Ppassword -S SQl_server
> This will allow you to go to a SQL prompt:-
> 1>
> Here you execute the xp_cmdshell
> 1>master..xp_cmdsehll 'c:\program files\7-zip\7z a -tzip'
> 2>go
> Note:
> Please use the syntax clearly
> --
> Thanks
> Hari
> MCDBA
> "Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
> news:uPWCBNhUEHA.3988@.tk2msftngp13.phx.gbl...
> same
> running
> It
an[vbcol=seagreen]
to[vbcol=seagreen]
it,[vbcol=seagreen]
> bat
file.[vbcol=seagreen]
> "open"
a[vbcol=seagreen]
be
> that
>
|||Did you qualify the path for both the input as well as output files?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message news:uPWCBNhUEHA.3988@.tk2msftngp13.phx.gbl...
> Hi Hari
> Thanks for the advise. I've just tried it, but it seems like it has the same
> problem as when I run it un a job.
> The commandline I'm running is : "c:\program files\7-zip\7z" a -tzip
> filename.zip filename.mdc
> This works fine when running it either as a bat file or just in a cmd
> window, but from within SQL it seems to fail. The output I get from running
> it either as a job or with the XP_CmdShell is :
> NULL
> 7-Zip 2.30 Beta 28 Copyright (c) 1999-2003 Igor Pavlov 2003-02-16
> Scanning
> NULL
> Updating archive filename.zip
> NULL
> NULL
> Everything is Ok
> NULL
> It reports that everything is ok, but it just don't create the zip file. It
> might be that this 7-zip program just can't run properly without having an
> open cmd prompt - which of course is a bit weird.
> Regards
> Steen
>
>
> "Hari" <hari_prasad_k@.hotmail.com> skrev i en meddelelse
> news:eCrlkGhUEHA.484@.TK2MSFTNGP10.phx.gbl...
> from
> zip
> it
> It
> a
> as
>
|||Solved it.....
In my bat file I just changed to the directory where the files where
placed - that did the trick(..should have thought about that from the very
beginning...).
It might as well work if I specify the full path for both input and output
files as Tibor suggest, but I haven't tried it.
Thanks for all your suggestions.
Regards
Steen
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> skrev i
en meddelelse news:%23lkrJmhUEHA.2692@.TK2MSFTNGP09.phx.gbl...
> Did you qualify the path for both the input as well as output files?
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
news:uPWCBNhUEHA.3988@.tk2msftngp13.phx.gbl...[vbcol=seagreen]
same[vbcol=seagreen]
running[vbcol=seagreen]
It[vbcol=seagreen]
an[vbcol=seagreen]
to[vbcol=seagreen]
it,[vbcol=seagreen]
bat[vbcol=seagreen]
file.[vbcol=seagreen]
"open"[vbcol=seagreen]
a[vbcol=seagreen]
be[vbcol=seagreen]
that
>
|||Make sure the sqlagent account has enough permission to zip. Also you might
try winzip 8.0 command line addon. It's working for me.
"Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
news:uKWljChUEHA.1764@.TK2MSFTNGP10.phx.gbl...
> Hi
> I'm having a strange problem which puzzels me a little bit.
> I have created a SQL job that can zip a file that has been generated from
a
> provious job. I've made a bat file that contains the string to run to zip
> the file. When I run this bat file manually just by doubleclicking it, it
> runs fine and do the job. When I set the SQL job to execute the same bat
> file, it executes the bat file, but the bat file doesn't zip the file. It
> reports that everything is ok, but the file isn't being created.
> It seems like the zip program I've found that can be executed from a
command
> line (it's a program called 7-zip) will only do the job if it can "open" a
> command prompt in the background which SQL apparently doesn't do.
> My question is now if any of you know a way to let a SQL job "open" a
> command prompt and then execute a program from there. It could also be as
> simple as using a different zip program. 7-zip was just one I found that
> could zip a file from a command line.
> Regards
> Steen
>
|||In article <uKWljChUEHA.1764@.TK2MSFTNGP10.phx.gbl>, "Steen Persson" <SPE@.REMOVEdatea.dk> wrote:
>Hi
>I'm having a strange problem which puzzels me a little bit.
>I have created a SQL job that can zip a file that has been generated from a
>provious job. I've made a bat file that contains the string to run to zip
>the file. When I run this bat file manually just by doubleclicking it, it
>runs fine and do the job. When I set the SQL job to execute the same bat
>file, it executes the bat file, but the bat file doesn't zip the file. It
>reports that everything is ok, but the file isn't being created.
>It seems like the zip program I've found that can be executed from a command
>line (it's a program called 7-zip) will only do the job if it can "open" a
>command prompt in the background which SQL apparently doesn't do.
>My question is now if any of you know a way to let a SQL job "open" a
>command prompt and then execute a program from there. It could also be as
>simple as using a different zip program. 7-zip was just one I found that
>could zip a file from a command line.
>Regards
>Steen
Use PKZip.
The original and best cmdline tool.

Running a program from a SQL job

Hi
I'm having a strange problem which puzzels me a little bit.
I have created a SQL job that can zip a file that has been generated from a
provious job. I've made a bat file that contains the string to run to zip
the file. When I run this bat file manually just by doubleclicking it, it
runs fine and do the job. When I set the SQL job to execute the same bat
file, it executes the bat file, but the bat file doesn't zip the file. It
reports that everything is ok, but the file isn't being created.
It seems like the zip program I've found that can be executed from a command
line (it's a program called 7-zip) will only do the job if it can "open" a
command prompt in the background which SQL apparently doesn't do.
My question is now if any of you know a way to let a SQL job "open" a
command prompt and then execute a program from there. It could also be as
simple as using a different zip program. 7-zip was just one I found that
could zip a file from a command line.
Regards
SteenHi,
Use XP_CMDSHELL to fire a OS command from command prompt.
Before commentng more, can you send out the script you are trying out.
Thanks
Hari
MCDBA
"Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
news:uKWljChUEHA.1764@.TK2MSFTNGP10.phx.gbl...
> Hi
> I'm having a strange problem which puzzels me a little bit.
> I have created a SQL job that can zip a file that has been generated from
a
> provious job. I've made a bat file that contains the string to run to zip
> the file. When I run this bat file manually just by doubleclicking it, it
> runs fine and do the job. When I set the SQL job to execute the same bat
> file, it executes the bat file, but the bat file doesn't zip the file. It
> reports that everything is ok, but the file isn't being created.
> It seems like the zip program I've found that can be executed from a
command
> line (it's a program called 7-zip) will only do the job if it can "open" a
> command prompt in the background which SQL apparently doesn't do.
> My question is now if any of you know a way to let a SQL job "open" a
> command prompt and then execute a program from there. It could also be as
> simple as using a different zip program. 7-zip was just one I found that
> could zip a file from a command line.
> Regards
> Steen
>|||Hi Hari
Thanks for the advise. I've just tried it, but it seems like it has the same
problem as when I run it un a job.
The commandline I'm running is : "c:\program files\7-zip\7z" a -tzip
filename.zip filename.mdc
This works fine when running it either as a bat file or just in a cmd
window, but from within SQL it seems to fail. The output I get from running
it either as a job or with the XP_CmdShell is :
NULL
7-Zip 2.30 Beta 28 Copyright (c) 1999-2003 Igor Pavlov 2003-02-16
Scanning
NULL
Updating archive filename.zip
NULL
NULL
Everything is Ok
NULL
It reports that everything is ok, but it just don't create the zip file. It
might be that this 7-zip program just can't run properly without having an
open cmd prompt - which of course is a bit weird.
Regards
Steen
"Hari" <hari_prasad_k@.hotmail.com> skrev i en meddelelse
news:eCrlkGhUEHA.484@.TK2MSFTNGP10.phx.gbl...
> Hi,
> Use XP_CMDSHELL to fire a OS command from command prompt.
> Before commentng more, can you send out the script you are trying out.
> --
> Thanks
> Hari
> MCDBA
> "Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
> news:uKWljChUEHA.1764@.TK2MSFTNGP10.phx.gbl...
from[vbcol=seagreen]
> a
zip[vbcol=seagreen]
it[vbcol=seagreen]
It[vbcol=seagreen]
> command
a[vbcol=seagreen]
as[vbcol=seagreen]
>|||Hi,
Login to SQL server from command prompt:-
OSQL -Usa -Ppassword -S SQl_server
This will allow you to go to a SQL prompt:-
1>
Here you execute the xp_cmdshell
1>master..xp_cmdsehll 'c:\program files\7-zip\7z a -tzip'
2>go
Note:
Please use the syntax clearly
Thanks
Hari
MCDBA
"Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
news:uPWCBNhUEHA.3988@.tk2msftngp13.phx.gbl...
> Hi Hari
> Thanks for the advise. I've just tried it, but it seems like it has the
same
> problem as when I run it un a job.
> The commandline I'm running is : "c:\program files\7-zip\7z" a -tzip
> filename.zip filename.mdc
> This works fine when running it either as a bat file or just in a cmd
> window, but from within SQL it seems to fail. The output I get from
running
> it either as a job or with the XP_CmdShell is :
> NULL
> 7-Zip 2.30 Beta 28 Copyright (c) 1999-2003 Igor Pavlov 2003-02-16
> Scanning
> NULL
> Updating archive filename.zip
> NULL
> NULL
> Everything is Ok
> NULL
> It reports that everything is ok, but it just don't create the zip file.
It
> might be that this 7-zip program just can't run properly without having an
> open cmd prompt - which of course is a bit weird.
> Regards
> Steen
>
>
> "Hari" <hari_prasad_k@.hotmail.com> skrev i en meddelelse
> news:eCrlkGhUEHA.484@.TK2MSFTNGP10.phx.gbl...
> from
> zip
> it
bat[vbcol=seagreen]
> It
"open"[vbcol=seagreen]
> a
> as
that[vbcol=seagreen]
>|||Hi Hari
Thansk for your suggestions, but it simply won't do it. I get the same
result when running is with the Osql command. Apparently this zip program
only works when it's launched from it's "own" cmd prompt.
Steen
"Hari" <hari_prasad_k@.hotmail.com> skrev i en meddelelse
news:%23zI$HThUEHA.1020@.TK2MSFTNGP11.phx.gbl...
> Hi,
> Login to SQL server from command prompt:-
> OSQL -Usa -Ppassword -S SQl_server
> This will allow you to go to a SQL prompt:-
> 1>
> Here you execute the xp_cmdshell
> 1>master..xp_cmdsehll 'c:\program files\7-zip\7z a -tzip'
> 2>go
> Note:
> Please use the syntax clearly
> --
> Thanks
> Hari
> MCDBA
> "Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
> news:uPWCBNhUEHA.3988@.tk2msftngp13.phx.gbl...
> same
> running
> It
an[vbcol=seagreen]
to[vbcol=seagreen]
it,[vbcol=seagreen]
> bat
file.[vbcol=seagreen]
> "open"
a[vbcol=seagreen]
be[vbcol=seagreen]
> that
>|||Did you qualify the path for both the input as well as output files?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message news:uPWCBNhUEHA.3988@.tk2msftngp13.phx
.gbl...
> Hi Hari
> Thanks for the advise. I've just tried it, but it seems like it has the sa
me
> problem as when I run it un a job.
> The commandline I'm running is : "c:\program files\7-zip\7z" a -tzip
> filename.zip filename.mdc
> This works fine when running it either as a bat file or just in a cmd
> window, but from within SQL it seems to fail. The output I get from runnin
g
> it either as a job or with the XP_CmdShell is :
> NULL
> 7-Zip 2.30 Beta 28 Copyright (c) 1999-2003 Igor Pavlov 2003-02-16
> Scanning
> NULL
> Updating archive filename.zip
> NULL
> NULL
> Everything is Ok
> NULL
> It reports that everything is ok, but it just don't create the zip file. I
t
> might be that this 7-zip program just can't run properly without having an
> open cmd prompt - which of course is a bit weird.
> Regards
> Steen
>
>
> "Hari" <hari_prasad_k@.hotmail.com> skrev i en meddelelse
> news:eCrlkGhUEHA.484@.TK2MSFTNGP10.phx.gbl...
> from
> zip
> it
> It
> a
> as
>|||Solved it.....
In my bat file I just changed to the directory where the files where
placed - that did the trick(..should have thought about that from the very
beginning...).
It might as well work if I specify the full path for both input and output
files as Tibor suggest, but I haven't tried it.
Thanks for all your suggestions.
Regards
Steen
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> skrev i
en meddelelse news:%23lkrJmhUEHA.2692@.TK2MSFTNGP09.phx.gbl...
> Did you qualify the path for both the input as well as output files?
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
news:uPWCBNhUEHA.3988@.tk2msftngp13.phx.gbl...
same[vbcol=seagreen]
running[vbcol=seagreen]
It[vbcol=seagreen]
an[vbcol=seagreen]
to[vbcol=seagreen]
it,[vbcol=seagreen]
bat[vbcol=seagreen]
file.[vbcol=seagreen]
"open"[vbcol=seagreen]
a[vbcol=seagreen]
be[vbcol=seagreen]
that[vbcol=seagreen]
>|||Make sure the sqlagent account has enough permission to zip. Also you might
try winzip 8.0 command line addon. It's working for me.
"Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
news:uKWljChUEHA.1764@.TK2MSFTNGP10.phx.gbl...
> Hi
> I'm having a strange problem which puzzels me a little bit.
> I have created a SQL job that can zip a file that has been generated from
a
> provious job. I've made a bat file that contains the string to run to zip
> the file. When I run this bat file manually just by doubleclicking it, it
> runs fine and do the job. When I set the SQL job to execute the same bat
> file, it executes the bat file, but the bat file doesn't zip the file. It
> reports that everything is ok, but the file isn't being created.
> It seems like the zip program I've found that can be executed from a
command
> line (it's a program called 7-zip) will only do the job if it can "open" a
> command prompt in the background which SQL apparently doesn't do.
> My question is now if any of you know a way to let a SQL job "open" a
> command prompt and then execute a program from there. It could also be as
> simple as using a different zip program. 7-zip was just one I found that
> could zip a file from a command line.
> Regards
> Steen
>|||In article <uKWljChUEHA.1764@.TK2MSFTNGP10.phx.gbl>, "Steen Persson" <SPE@.REMOVEdatea.dk> wro
te:
>Hi
>I'm having a strange problem which puzzels me a little bit.
>I have created a SQL job that can zip a file that has been generated from a
>provious job. I've made a bat file that contains the string to run to zip
>the file. When I run this bat file manually just by doubleclicking it, it
>runs fine and do the job. When I set the SQL job to execute the same bat
>file, it executes the bat file, but the bat file doesn't zip the file. It
>reports that everything is ok, but the file isn't being created.
>It seems like the zip program I've found that can be executed from a comman
d
>line (it's a program called 7-zip) will only do the job if it can "open" a
>command prompt in the background which SQL apparently doesn't do.
>My question is now if any of you know a way to let a SQL job "open" a
>command prompt and then execute a program from there. It could also be as
>simple as using a different zip program. 7-zip was just one I found that
>could zip a file from a command line.
>Regards
>Steen
Use PKZip.
The original and best cmdline tool.

Running a program from a SQL job

Hi
I'm having a strange problem which puzzels me a little bit.
I have created a SQL job that can zip a file that has been generated from a
provious job. I've made a bat file that contains the string to run to zip
the file. When I run this bat file manually just by doubleclicking it, it
runs fine and do the job. When I set the SQL job to execute the same bat
file, it executes the bat file, but the bat file doesn't zip the file. It
reports that everything is ok, but the file isn't being created.
It seems like the zip program I've found that can be executed from a command
line (it's a program called 7-zip) will only do the job if it can "open" a
command prompt in the background which SQL apparently doesn't do.
My question is now if any of you know a way to let a SQL job "open" a
command prompt and then execute a program from there. It could also be as
simple as using a different zip program. 7-zip was just one I found that
could zip a file from a command line.
Regards
SteenHi,
Use XP_CMDSHELL to fire a OS command from command prompt.
Before commentng more, can you send out the script you are trying out.
--
Thanks
Hari
MCDBA
"Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
news:uKWljChUEHA.1764@.TK2MSFTNGP10.phx.gbl...
> Hi
> I'm having a strange problem which puzzels me a little bit.
> I have created a SQL job that can zip a file that has been generated from
a
> provious job. I've made a bat file that contains the string to run to zip
> the file. When I run this bat file manually just by doubleclicking it, it
> runs fine and do the job. When I set the SQL job to execute the same bat
> file, it executes the bat file, but the bat file doesn't zip the file. It
> reports that everything is ok, but the file isn't being created.
> It seems like the zip program I've found that can be executed from a
command
> line (it's a program called 7-zip) will only do the job if it can "open" a
> command prompt in the background which SQL apparently doesn't do.
> My question is now if any of you know a way to let a SQL job "open" a
> command prompt and then execute a program from there. It could also be as
> simple as using a different zip program. 7-zip was just one I found that
> could zip a file from a command line.
> Regards
> Steen
>|||Hi Hari
Thanks for the advise. I've just tried it, but it seems like it has the same
problem as when I run it un a job.
The commandline I'm running is : "c:\program files\7-zip\7z" a -tzip
filename.zip filename.mdc
This works fine when running it either as a bat file or just in a cmd
window, but from within SQL it seems to fail. The output I get from running
it either as a job or with the XP_CmdShell is :
NULL
7-Zip 2.30 Beta 28 Copyright (c) 1999-2003 Igor Pavlov 2003-02-16
Scanning
NULL
Updating archive filename.zip
NULL
NULL
Everything is Ok
NULL
It reports that everything is ok, but it just don't create the zip file. It
might be that this 7-zip program just can't run properly without having an
open cmd prompt - which of course is a bit weird.
Regards
Steen
"Hari" <hari_prasad_k@.hotmail.com> skrev i en meddelelse
news:eCrlkGhUEHA.484@.TK2MSFTNGP10.phx.gbl...
> Hi,
> Use XP_CMDSHELL to fire a OS command from command prompt.
> Before commentng more, can you send out the script you are trying out.
> --
> Thanks
> Hari
> MCDBA
> "Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
> news:uKWljChUEHA.1764@.TK2MSFTNGP10.phx.gbl...
> > Hi
> >
> > I'm having a strange problem which puzzels me a little bit.
> > I have created a SQL job that can zip a file that has been generated
from
> a
> > provious job. I've made a bat file that contains the string to run to
zip
> > the file. When I run this bat file manually just by doubleclicking it,
it
> > runs fine and do the job. When I set the SQL job to execute the same bat
> > file, it executes the bat file, but the bat file doesn't zip the file.
It
> > reports that everything is ok, but the file isn't being created.
> >
> > It seems like the zip program I've found that can be executed from a
> command
> > line (it's a program called 7-zip) will only do the job if it can "open"
a
> > command prompt in the background which SQL apparently doesn't do.
> > My question is now if any of you know a way to let a SQL job "open" a
> > command prompt and then execute a program from there. It could also be
as
> > simple as using a different zip program. 7-zip was just one I found that
> > could zip a file from a command line.
> >
> > Regards
> > Steen
> >
> >
>|||Hi,
Login to SQL server from command prompt:-
OSQL -Usa -Ppassword -S SQl_server
This will allow you to go to a SQL prompt:-
1>
Here you execute the xp_cmdshell
1>master..xp_cmdsehll 'c:\program files\7-zip\7z a -tzip'
2>go
Note:
Please use the syntax clearly
--
Thanks
Hari
MCDBA
"Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
news:uPWCBNhUEHA.3988@.tk2msftngp13.phx.gbl...
> Hi Hari
> Thanks for the advise. I've just tried it, but it seems like it has the
same
> problem as when I run it un a job.
> The commandline I'm running is : "c:\program files\7-zip\7z" a -tzip
> filename.zip filename.mdc
> This works fine when running it either as a bat file or just in a cmd
> window, but from within SQL it seems to fail. The output I get from
running
> it either as a job or with the XP_CmdShell is :
> NULL
> 7-Zip 2.30 Beta 28 Copyright (c) 1999-2003 Igor Pavlov 2003-02-16
> Scanning
> NULL
> Updating archive filename.zip
> NULL
> NULL
> Everything is Ok
> NULL
> It reports that everything is ok, but it just don't create the zip file.
It
> might be that this 7-zip program just can't run properly without having an
> open cmd prompt - which of course is a bit weird.
> Regards
> Steen
>
>
> "Hari" <hari_prasad_k@.hotmail.com> skrev i en meddelelse
> news:eCrlkGhUEHA.484@.TK2MSFTNGP10.phx.gbl...
> > Hi,
> >
> > Use XP_CMDSHELL to fire a OS command from command prompt.
> >
> > Before commentng more, can you send out the script you are trying out.
> >
> > --
> > Thanks
> > Hari
> > MCDBA
> > "Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
> > news:uKWljChUEHA.1764@.TK2MSFTNGP10.phx.gbl...
> > > Hi
> > >
> > > I'm having a strange problem which puzzels me a little bit.
> > > I have created a SQL job that can zip a file that has been generated
> from
> > a
> > > provious job. I've made a bat file that contains the string to run to
> zip
> > > the file. When I run this bat file manually just by doubleclicking it,
> it
> > > runs fine and do the job. When I set the SQL job to execute the same
bat
> > > file, it executes the bat file, but the bat file doesn't zip the file.
> It
> > > reports that everything is ok, but the file isn't being created.
> > >
> > > It seems like the zip program I've found that can be executed from a
> > command
> > > line (it's a program called 7-zip) will only do the job if it can
"open"
> a
> > > command prompt in the background which SQL apparently doesn't do.
> > > My question is now if any of you know a way to let a SQL job "open" a
> > > command prompt and then execute a program from there. It could also be
> as
> > > simple as using a different zip program. 7-zip was just one I found
that
> > > could zip a file from a command line.
> > >
> > > Regards
> > > Steen
> > >
> > >
> >
> >
>|||Hi Hari
Thansk for your suggestions, but it simply won't do it. I get the same
result when running is with the Osql command. Apparently this zip program
only works when it's launched from it's "own" cmd prompt.
Steen
"Hari" <hari_prasad_k@.hotmail.com> skrev i en meddelelse
news:%23zI$HThUEHA.1020@.TK2MSFTNGP11.phx.gbl...
> Hi,
> Login to SQL server from command prompt:-
> OSQL -Usa -Ppassword -S SQl_server
> This will allow you to go to a SQL prompt:-
> 1>
> Here you execute the xp_cmdshell
> 1>master..xp_cmdsehll 'c:\program files\7-zip\7z a -tzip'
> 2>go
> Note:
> Please use the syntax clearly
> --
> Thanks
> Hari
> MCDBA
> "Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
> news:uPWCBNhUEHA.3988@.tk2msftngp13.phx.gbl...
> > Hi Hari
> >
> > Thanks for the advise. I've just tried it, but it seems like it has the
> same
> > problem as when I run it un a job.
> >
> > The commandline I'm running is : "c:\program files\7-zip\7z" a -tzip
> > filename.zip filename.mdc
> >
> > This works fine when running it either as a bat file or just in a cmd
> > window, but from within SQL it seems to fail. The output I get from
> running
> > it either as a job or with the XP_CmdShell is :
> >
> > NULL
> > 7-Zip 2.30 Beta 28 Copyright (c) 1999-2003 Igor Pavlov 2003-02-16
> > Scanning
> > NULL
> > Updating archive filename.zip
> > NULL
> > NULL
> > Everything is Ok
> > NULL
> >
> > It reports that everything is ok, but it just don't create the zip file.
> It
> > might be that this 7-zip program just can't run properly without having
an
> > open cmd prompt - which of course is a bit weird.
> >
> > Regards
> > Steen
> >
> >
> >
> >
> >
> > "Hari" <hari_prasad_k@.hotmail.com> skrev i en meddelelse
> > news:eCrlkGhUEHA.484@.TK2MSFTNGP10.phx.gbl...
> > > Hi,
> > >
> > > Use XP_CMDSHELL to fire a OS command from command prompt.
> > >
> > > Before commentng more, can you send out the script you are trying out.
> > >
> > > --
> > > Thanks
> > > Hari
> > > MCDBA
> > > "Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
> > > news:uKWljChUEHA.1764@.TK2MSFTNGP10.phx.gbl...
> > > > Hi
> > > >
> > > > I'm having a strange problem which puzzels me a little bit.
> > > > I have created a SQL job that can zip a file that has been generated
> > from
> > > a
> > > > provious job. I've made a bat file that contains the string to run
to
> > zip
> > > > the file. When I run this bat file manually just by doubleclicking
it,
> > it
> > > > runs fine and do the job. When I set the SQL job to execute the same
> bat
> > > > file, it executes the bat file, but the bat file doesn't zip the
file.
> > It
> > > > reports that everything is ok, but the file isn't being created.
> > > >
> > > > It seems like the zip program I've found that can be executed from a
> > > command
> > > > line (it's a program called 7-zip) will only do the job if it can
> "open"
> > a
> > > > command prompt in the background which SQL apparently doesn't do.
> > > > My question is now if any of you know a way to let a SQL job "open"
a
> > > > command prompt and then execute a program from there. It could also
be
> > as
> > > > simple as using a different zip program. 7-zip was just one I found
> that
> > > > could zip a file from a command line.
> > > >
> > > > Regards
> > > > Steen
> > > >
> > > >
> > >
> > >
> >
> >
>|||Did you qualify the path for both the input as well as output files?
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message news:uPWCBNhUEHA.3988@.tk2msftngp13.phx.gbl...
> Hi Hari
> Thanks for the advise. I've just tried it, but it seems like it has the same
> problem as when I run it un a job.
> The commandline I'm running is : "c:\program files\7-zip\7z" a -tzip
> filename.zip filename.mdc
> This works fine when running it either as a bat file or just in a cmd
> window, but from within SQL it seems to fail. The output I get from running
> it either as a job or with the XP_CmdShell is :
> NULL
> 7-Zip 2.30 Beta 28 Copyright (c) 1999-2003 Igor Pavlov 2003-02-16
> Scanning
> NULL
> Updating archive filename.zip
> NULL
> NULL
> Everything is Ok
> NULL
> It reports that everything is ok, but it just don't create the zip file. It
> might be that this 7-zip program just can't run properly without having an
> open cmd prompt - which of course is a bit weird.
> Regards
> Steen
>
>
> "Hari" <hari_prasad_k@.hotmail.com> skrev i en meddelelse
> news:eCrlkGhUEHA.484@.TK2MSFTNGP10.phx.gbl...
> > Hi,
> >
> > Use XP_CMDSHELL to fire a OS command from command prompt.
> >
> > Before commentng more, can you send out the script you are trying out.
> >
> > --
> > Thanks
> > Hari
> > MCDBA
> > "Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
> > news:uKWljChUEHA.1764@.TK2MSFTNGP10.phx.gbl...
> > > Hi
> > >
> > > I'm having a strange problem which puzzels me a little bit.
> > > I have created a SQL job that can zip a file that has been generated
> from
> > a
> > > provious job. I've made a bat file that contains the string to run to
> zip
> > > the file. When I run this bat file manually just by doubleclicking it,
> it
> > > runs fine and do the job. When I set the SQL job to execute the same bat
> > > file, it executes the bat file, but the bat file doesn't zip the file.
> It
> > > reports that everything is ok, but the file isn't being created.
> > >
> > > It seems like the zip program I've found that can be executed from a
> > command
> > > line (it's a program called 7-zip) will only do the job if it can "open"
> a
> > > command prompt in the background which SQL apparently doesn't do.
> > > My question is now if any of you know a way to let a SQL job "open" a
> > > command prompt and then execute a program from there. It could also be
> as
> > > simple as using a different zip program. 7-zip was just one I found that
> > > could zip a file from a command line.
> > >
> > > Regards
> > > Steen
> > >
> > >
> >
> >
>|||Solved it.....
In my bat file I just changed to the directory where the files where
placed - that did the trick(..should have thought about that from the very
beginning...).
It might as well work if I specify the full path for both input and output
files as Tibor suggest, but I haven't tried it.
Thanks for all your suggestions.
Regards
Steen
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> skrev i
en meddelelse news:%23lkrJmhUEHA.2692@.TK2MSFTNGP09.phx.gbl...
> Did you qualify the path for both the input as well as output files?
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
news:uPWCBNhUEHA.3988@.tk2msftngp13.phx.gbl...
> > Hi Hari
> >
> > Thanks for the advise. I've just tried it, but it seems like it has the
same
> > problem as when I run it un a job.
> >
> > The commandline I'm running is : "c:\program files\7-zip\7z" a -tzip
> > filename.zip filename.mdc
> >
> > This works fine when running it either as a bat file or just in a cmd
> > window, but from within SQL it seems to fail. The output I get from
running
> > it either as a job or with the XP_CmdShell is :
> >
> > NULL
> > 7-Zip 2.30 Beta 28 Copyright (c) 1999-2003 Igor Pavlov 2003-02-16
> > Scanning
> > NULL
> > Updating archive filename.zip
> > NULL
> > NULL
> > Everything is Ok
> > NULL
> >
> > It reports that everything is ok, but it just don't create the zip file.
It
> > might be that this 7-zip program just can't run properly without having
an
> > open cmd prompt - which of course is a bit weird.
> >
> > Regards
> > Steen
> >
> >
> >
> >
> >
> > "Hari" <hari_prasad_k@.hotmail.com> skrev i en meddelelse
> > news:eCrlkGhUEHA.484@.TK2MSFTNGP10.phx.gbl...
> > > Hi,
> > >
> > > Use XP_CMDSHELL to fire a OS command from command prompt.
> > >
> > > Before commentng more, can you send out the script you are trying out.
> > >
> > > --
> > > Thanks
> > > Hari
> > > MCDBA
> > > "Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
> > > news:uKWljChUEHA.1764@.TK2MSFTNGP10.phx.gbl...
> > > > Hi
> > > >
> > > > I'm having a strange problem which puzzels me a little bit.
> > > > I have created a SQL job that can zip a file that has been generated
> > from
> > > a
> > > > provious job. I've made a bat file that contains the string to run
to
> > zip
> > > > the file. When I run this bat file manually just by doubleclicking
it,
> > it
> > > > runs fine and do the job. When I set the SQL job to execute the same
bat
> > > > file, it executes the bat file, but the bat file doesn't zip the
file.
> > It
> > > > reports that everything is ok, but the file isn't being created.
> > > >
> > > > It seems like the zip program I've found that can be executed from a
> > > command
> > > > line (it's a program called 7-zip) will only do the job if it can
"open"
> > a
> > > > command prompt in the background which SQL apparently doesn't do.
> > > > My question is now if any of you know a way to let a SQL job "open"
a
> > > > command prompt and then execute a program from there. It could also
be
> > as
> > > > simple as using a different zip program. 7-zip was just one I found
that
> > > > could zip a file from a command line.
> > > >
> > > > Regards
> > > > Steen
> > > >
> > > >
> > >
> > >
> >
> >
>|||Make sure the sqlagent account has enough permission to zip. Also you might
try winzip 8.0 command line addon. It's working for me.
"Steen Persson" <SPE@.REMOVEdatea.dk> wrote in message
news:uKWljChUEHA.1764@.TK2MSFTNGP10.phx.gbl...
> Hi
> I'm having a strange problem which puzzels me a little bit.
> I have created a SQL job that can zip a file that has been generated from
a
> provious job. I've made a bat file that contains the string to run to zip
> the file. When I run this bat file manually just by doubleclicking it, it
> runs fine and do the job. When I set the SQL job to execute the same bat
> file, it executes the bat file, but the bat file doesn't zip the file. It
> reports that everything is ok, but the file isn't being created.
> It seems like the zip program I've found that can be executed from a
command
> line (it's a program called 7-zip) will only do the job if it can "open" a
> command prompt in the background which SQL apparently doesn't do.
> My question is now if any of you know a way to let a SQL job "open" a
> command prompt and then execute a program from there. It could also be as
> simple as using a different zip program. 7-zip was just one I found that
> could zip a file from a command line.
> Regards
> Steen
>|||In article <uKWljChUEHA.1764@.TK2MSFTNGP10.phx.gbl>, "Steen Persson" <SPE@.REMOVEdatea.dk> wrote:
>Hi
>I'm having a strange problem which puzzels me a little bit.
>I have created a SQL job that can zip a file that has been generated from a
>provious job. I've made a bat file that contains the string to run to zip
>the file. When I run this bat file manually just by doubleclicking it, it
>runs fine and do the job. When I set the SQL job to execute the same bat
>file, it executes the bat file, but the bat file doesn't zip the file. It
>reports that everything is ok, but the file isn't being created.
>It seems like the zip program I've found that can be executed from a command
>line (it's a program called 7-zip) will only do the job if it can "open" a
>command prompt in the background which SQL apparently doesn't do.
>My question is now if any of you know a way to let a SQL job "open" a
>command prompt and then execute a program from there. It could also be as
>simple as using a different zip program. 7-zip was just one I found that
>could zip a file from a command line.
>Regards
>Steen
Use PKZip.
The original and best cmdline tool.

Saturday, February 25, 2012

Run .SQL file

I have a whole bunch of update statments stored in a .sql
file. Is there any way to run it in the program (just pass
a filename)?
I know I can put the statments in a store procedure and
run the store procedure in the code such as
sqlcommand.commandtext="execute storeprocedure"
However, the database is in the client site and it's not
convient for them to change the store procedure. So I'd
like develop a functionality which can read and execute
the script file.
Any suggestion?
ThanksSee OSQL utility in BOL.
AMB
"Ying" wrote:

> I have a whole bunch of update statments stored in a .sql
> file. Is there any way to run it in the program (just pass
> a filename)?
> I know I can put the statments in a store procedure and
> run the store procedure in the code such as
> sqlcommand.commandtext="execute storeprocedure"
> However, the database is in the client site and it's not
> convient for them to change the store procedure. So I'd
> like develop a functionality which can read and execute
> the script file.
> Any suggestion?
> Thanks
>