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 |
|
mageshks
Yak Posting Veteran
59 Posts |
Posted - 2007-06-21 : 05:29:24
|
| I want to create a database,before that i want to check whether i have the permission to create a DB.(Im not creating this DB from Master)if db_id('TEST_DB') is nullCREATE DATABASE TEST_DB.What code i have to add before the above piece of code.So that my query shouldnt make any error like 'Permission denied..'Thanks in Advance |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2007-06-21 : 07:20:04
|
| You need to check if you are in the dbcreator or sysadmin server role.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
alexjamesbrown
Starting Member
48 Posts |
Posted - 2007-06-22 : 12:29:42
|
| like this:IF IS_MEMBER ('db_owner') = 1For more info, see this:http://technet.microsoft.com/en-us/library/ms186271.aspx |
 |
|
|
|
|
|