Microsoft
Software
Hardware
Network
Question : Create multiple SQL tables with script
I have a text file with one column of table names with a carriage return as a delimiter:
Table1
Table2
Table3
A simple CREATE TABLE script would have a variable @TableName and the script would look something like this. I will not be creating tables in the databases at the moment.
DECLARE @TableName varchar(20)
@TableName = c:\TextFile.txt (something like this, I don't know how to work out this logic)
CREATE DATABASE [@TableName] ON PRIMARY
( NAME = N'@TableName', FILENAME = N'E:\SQL_DBs\@TableName.md
f' )
LOG ON
( NAME = N'@TableName_log', FILENAME = N'F:\SQL_Logs\@TableName_l
og.ldf' )
GO
Any help would be appreciated.
Answer : Create multiple SQL tables with script
make it an exec(sql)
declare @sql varchar(max)
so you have
set @sql = ' create database '+ @table + ' On primary ' + .....
then exec(@sql)
Random Solutions
xp sp2 clients wont log or ping server 2003
I have a coolmax eSATA drive enclosure with a seagate SATA drive
Settings up vsftpd and ssl?
reCAPTCHA PHP not failing when nothing is entered; works fine when something is entered
How do I design network for failover to a secondary internet connection?
PayPal Express Checkout Module
Blackberry enterprise activation: Cannot find server
paypal mass payment api
BSOD Windows 2008 R2 Hyper-V
When does a DBMS become necessary/very useful to use in conjunction with ArcGIS? (rather than doing everything with ArcGIS)