• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 198
  • Last Modified:

SQL SERVER 2000/2005

I am using query analyzer to run the script .script is so longer.I want to verify or check which stage  has been completed during the script is running like when we take a backup its shows percentage 10,20 and so on .....on the
message window in the query anaylzer

Can I add this information in my script

Thanks
0
furqan_trakker
Asked:
furqan_trakker
  • 4
  • 2
  • 2
  • +1
1 Solution
 
mfhorizonCommented:
Hi furqan_trakker,

If your script is so longer and you want confirmation of execution in between, assuming that code is 1000 lines, i would select first 100 lines of code with taking care 100th line is with complete syntax and will EXECUTE the script, it will confirm me in the Message Pane below. I will comment these lines and will select next 100 lines with complete syntax and will repeat it until my script is completed.

Other way is you can program a vb form which executes every command and shows you result in a text box....

Hope you will find it well.

Cheers!!
0
 
udaya kumar laligondlaTechnical LeadCommented:
add statements for each stage as
Print "stage A1"
this will print when ever a stage is reached
0
 
furqan_trakkerAuthor Commented:
Hello mfhorizon
have you taken a backup of a database on query analyzer ?
0
[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

 
TejasShahMscITCommented:
Hi,

You can write "select 'Upto here' OR PRINT 'Upto here' " to make sure upto which line code has run.

0
 
furqan_trakkerAuthor Commented:
I have added print statement after some lines of code but messages print all at the same time just
code split into 6 stages

print 'Stage 1 Completed'
print 'Stage 2 Completed' and so on

but its print all after script completed
0
 
udaya kumar laligondlaTechnical LeadCommented:
use GO after the print statement
if you have configured some thing else as batch seperated use the same.
0
 
mfhorizonCommented:
Yes, you must use GO to tell the interpretor to execute next queries...
0
 
mfhorizonCommented:
Bakckup on query analyzer is simply like this

BACKUP DATABASE [MCI] TO  DISK = N'local_path\backupname.bak' WITH NOFORMAT, NOINIT,  NAME = N'MCI-Full Database Backup', SKIP, NOREWIND, NOUNLOAD,  STATS = 10
GO
0
 
mfhorizonCommented:
TRY TO CHECK YOU EXISTING SCRIPT SHOULD NOT HAVE "SET ECHO OFF" OR ANY OTHER SQL COMMAND THAT PUTS THE OUTPUT MESSAGE OFF. If you find comment it and the try!!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now