asp.net - Run Sql Script File With Passing database name from C# -


i have sql script file contains database creation, related tables creation , other things. database name decided client side. there way can run script file database name passed code?

i know way take special pattern in place of database name , in c# code replace client side added database name. there better way it?

if creating tables on fly in application, missed fundamentals database design. in relational database, set of tables , columns supposed constant. may change installation of new versions, not during run-time.

you can check here

create proc createdb @dbname sysname declare @sql nvarchar(max) set @sql = 'create database ' + quotename(@dbname) exec (@sql) 

here can pass @dbname parameter


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -