You are here: Re: Variabe Error « MsSQL Server « IT news, forums, messages
Re: Variabe Error

Posted by Jack Vamvas on 10/16/11 11:37

Take out the GO comments

--
Jack Vamvas
__________________________________________________________________
Receive free SQL tips - register at www.ciquery.com/remotedba.htm
SQL Server Performance Audit - check www.ciquery.com/sqlserver_audit.htm
New article by Jack Vamvas - SQL and Markov Chains -
www.ciquery.com/articles/art_04.asp
"Cecil" <cecilkain0@yahoo.com> wrote in message
news:1137514452.848879.303200@g47g2000cwa.googlegroups.com...
> I get this error:
> Msg 137, Level 15, State 2, Line 2
> Must declare the scalar variable "@DBName".
>
>
> W/ this code:
>
> --Constants
> DECLARE @DBName varchar(20);
> SET @DBName = 'Base';
> GO
>
>
> --Create & Use Database @DBName
> USE master
> GO
>
> if exists (select * from sysdatabases where name=@DBName)
> drop database @DBName
> GO
>
> CREATE DATABASE @DBName
> GO
> use @DBName
> GO
>
> How should this be done?
>

 

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

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