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 |
sunny_10
Yak Posting Veteran
72 Posts |
Posted - 2013-03-18 : 00:47:45
|
Hi I want to check whether Database exists or not , if not then i want to create Database & tables . How this can be done . I want this through Visual Basic.Thanks |
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-03-18 : 01:06:12
|
This is in SQL ServerIF NOT EXISTS (SELECT * FROM sys.databases where name = 'DBName') CREATE DATABASE DBName;GOUSE DBNameGOCREATE TABLE ..............--Chandu |
|
|
ScottPletcher
Aged Yak Warrior
550 Posts |
Posted - 2013-03-18 : 18:05:24
|
[code]IF NOT EXISTS (SELECT name FROM sys.databases where name = 'db_name')BEGIN CREATE DATABASE db_name; CREATE TABLE db_name.dbo.table_name1 ( .... ) CREATE TABLE db_name.dbo.table_name2 ( .... )END --IFGO[/code] |
|
|
|
|
|