March 17, 2009 at 8:16 pm
Ok, what you could do is to declare two variables:
Declare @s-2 nvarchar(4000)
Declare @s1 nvarchar(4000)
After this line:
set @s-2 = @s-2 + '"' + @dfname + '" to "' + @newdatapath + @dbname + '_' + @dfname + '_data' + @ext + '"'', @WITH = ''move '
put this condition:
if len(@s) >=3900
begin
set @s1= @s-2
set @s-2= ''
end
in the end put
print @s1
print @s-2
you would need to change this line:
exec master..sp_executesql @s-2
in order to run it or you can just concatenate the two printouts together and run it manually.
Alternatively you can use declare @s-2 varchar(8000) and comment out
the exec string.
I am not sure if nvarchar(max) will work with sp_executesql, but you may try this as well.
March 17, 2009 at 8:36 pm
instead doing this can we do with a cursor or some CTE's ?? just in case.
March 17, 2009 at 8:42 pm
Yes you can. You can use a larger datatype to fit your script and then just print it out. However 8000 character should work for your immidiate needs as your original script is only 5000 characters.
March 18, 2009 at 5:57 am
This was removed by the editor as SPAM
March 18, 2009 at 5:20 pm
I understand if you restore from one server to another with different drive and folder names, you would need to specify "with move" option. If the folder and drive structure is the same, you can restore without this option.
March 19, 2009 at 5:37 am
This was removed by the editor as SPAM
Viewing 7 posts - 16 through 22 (of 22 total)
You must be logged in to reply to this topic. Login to reply