Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jscot
Posting Yak Master
106 Posts |
Posted - 2009-12-31 : 02:55:47
|
| DECLARE @TestVariable varchar(30) SET @TestVariable = 123 PRINT @TESTVARIABLEI want to modify my script if a database has been dropped, you will not print a result for that database ID value.Please help me with t-sql code. Thanks in advance. |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-12-31 : 04:22:24
|
if (object_name(123) is not null)begin print 123end No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-12-31 : 04:23:08
|
| Your question is not clear. What do you want to print?MadhivananFailing to plan is Planning to fail |
 |
|
|
Sonu619
Posting Yak Master
202 Posts |
Posted - 2009-12-31 : 13:07:43
|
| I am trying to modify this scriptSELECT DB_NAME( 1 );**** If database dropped, you will not print a result for that database ID value. Thanks. |
 |
|
|
Sonu619
Posting Yak Master
202 Posts |
Posted - 2009-12-31 : 13:33:22
|
| Scot your if i am not wrong you trying to ask:-SELECT DB_NAME( 1 );**** If database dropped, you will not print a result for that database ID value. |
 |
|
|
jscot
Posting Yak Master
106 Posts |
Posted - 2009-12-31 : 13:39:15
|
| I am sorry I didn't clear my question. yes u r right sonu, My question is :-SELECT DB_NAME( 1 );**** If database dropped, you will not print a result for that database ID value. |
 |
|
|
|
|
|