Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Passing variable to ALTER DATABASE

Posted on 2004-10-08
2
Medium Priority
?
566 Views
Last Modified: 2008-02-01
Is it possible to pass a variable to the ALTER DATABASE command?

ALTER DATABSE @dbname ....

If no then is there a way around this?

Thanks

0
Comment
Question by:n0ch1ps
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Accepted Solution

by:
boblah earned 1000 total points
ID: 12257993
Hi n0ch1ps,

try

EXEC('ALTER DATABASE ' + @dbname + '...

Cheers!
0
 
LVL 5

Author Comment

by:n0ch1ps
ID: 12258080
ésa es gracias excelentes

n0ch1ps
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question