I have a text file with one column of table names with a carriage return as a delimiter:
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.mdf' )
( NAME = N'@TableName_log', FILENAME = N'F:\SQL_Logs\@TableName_log.ldf' )
Any help would be appreciated.