You are here: Re: Go and goto in one sql script gives error label not declared « MsSQL Server « IT news, forums, messages
Re: Go and goto in one sql script gives error label not declared

Posted by Erland Sommarskog on 01/15/07 14:51

BF (bob@faessen.net) writes:
> For each new version I create an update script, We have an app which
> does that and there are lots of Go commands.

No there isn't. There are a lot of GO separators.

> I want to have one update script for all versions of the app so we have
> 2.00 to 2.01 to 2.02 to 2.03 etc.
>
> For each version I have a script and I want to lookup the version, if
> version is 2.03 I can start updating from 2.03 to 2.04 with the goto I
> can jump over all other updates because they are already done in the
> past.
>
> When I use different files I cannot easy control which files to
> execute, or I have to run them from the main script.

Right. The best way is to solve this is to write a little script runner that
reads a suite of files, and from the file names decudes which version the
file applies to, and then runs the file if needed. Your script would have to
break the script apart on the "go" separator, but this is trivial stuff.
(Hint: don't worry about "go" being entwined in comments ot string literals.
The standard query tools don't do that either. But care about leading and
trailing blanks, and inconsistent use of upper/lowercase.)

You can write this simple script runner in about any language - except for
T-SQK.

--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

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

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