how to create sqlserver database at runtime using

By jideesh1010 ·
plz replay soon

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

Right, sure.

by Absolutely In reply to how to create sqlserver d ...

How to create nonsense at anytime.

Collapse -

That's a can of worms

by Tony Hopkinson In reply to how to create sqlserver d ...

Open a connection to the Master Database with a user with the create databases privilege.
Exec a query on the connection with CREATE DATABASE... in it.

Normally only the sa would be able to create databases, given on most setups that's windows admin, it's likely that the user won't know that password. You could give create database to all and sundry, or you could set up for mixed mode, and set up a SQL user / password with the privilege.

Oh and we haven't gone near setting up the users, tables, sps, functions, permissions....

You can get round all this crap eventually, but when you have and you release version two which requires an updated schema, then you have pain.

Don't do this unless you really really really have to.

Related Discussions

Related Forums