sql server - I want to use the variable I declared somewhere else but I cannot (simple sql query) -
declare @path text; set @path = 'c:\bulk' bulk insert [humanresources].[employee] -- want use variable here !! ( check_constraints, codepage='acp', datafiletype='widechar', fieldterminator='\t', rowterminator='\n', keepidentity, tablock );
declare @path nvarchar(2000); set @path = 'c:\bulk.(extension)'; declare @sql nvarchar(max) = '''bulk insert [humanresources].[employee] from' + @path + ' ( check_constraints, codepage=''acp'', datafiletype=''widechar'', fieldterminator=''\t'', rowterminator=''\n'', keepidentity, tablock )''' execute sp_executesql(@sql)
Comments
Post a Comment