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
Post a Comment