Dynamically Create and Add Database to SQL Server using C#

shameer
 
on Feb 28, 2013 03:45 AM
3681 Views

hi all.

I am having an initial database with name as DB1,

Now when each user registers for my site, a new database is created dynamically,

so i need to increment the database name from DB1 to DB2, DB3 and so on..

and it should check the previous database name before creating a new database.

any help regarding this scenario will be thankful..

Download FREE API for Word, Excel and PDF in ASP.Net: Download
Mudassar
 
on Feb 28, 2013 03:47 AM

1. You can use the following query to get the List of databases

SELECT name
FROM master..sysdatabases

And then you can create databases programatically using

http://support.microsoft.com/kb/307283