You are here: Re: Testing load scripts « MsSQL Server « IT news, forums, messages
Re: Testing load scripts

Posted by xAvailx on 10/23/06 16:10

For automation, I would check out the command line utilities: isql,
osql or sqlcmd depending on which version of sql server you are using.

We often run our tests from command scripts. e.g. Copy the following
into a cmd file (MyTest.cmd). You can then execute as follows:
MyTest.cmd myserver mydatabase

--------------------------------------------------

@echo off
REM: Usage: CommandFilename [Server] [Database]

if '%1' == '' goto usage
if '%2' == '' goto usage

if '%1' == '/?' goto usage
if '%1' == '-?' goto usage
if '%1' == '?' goto usage
if '%1' == '/help' goto usage

sqlcmd -S %1 -d %2 -E -b -i "MyScript.sql"
if %ERRORLEVEL% NEQ 0 goto errors

REM: More scripts...

goto finish

REM: How to use screen
:usage
echo.
echo Usage: MyScript Server Database
echo Server: the name of the target SQL Server
echo Database: the name of the target database
echo.
echo Example: MyScript.cmd MainServer MainDatabase
echo.
echo.
goto done

REM: error handler
:errors
echo.
echo WARNING! Error(s) were detected!
echo --------------------------------
echo Please evaluate the situation and, if needed,
echo restart this command file. You may need to
echo supply command parameters when executing
echo this command file.
echo.
pause
goto done

REM: finished execution
:finish
echo.
echo Script execution is complete!
:done
@echo on

--------------------------------------------------

HTH


tamatem wrote:
> I have build a long sql data load script. What is the best way to do
> Testing of the script? I would like to automate the test!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация