November 5, 2019 at 7:03 am
How can I generate sqlservername in the middle of an UNC path?
select N'\\ABCD\EFGH\IJKL\MNSP\("select @@servername")\AL.txt'
If servername is MYSERVER then UNC path should be..
Result should be \\ABCD\EFGH\IJKL\MNSP\MYSERVER\AL.txt
MVDBA (Mike Vessey)
November 5, 2019 at 9:11 am
select N'\\ABCD\EFGH\IJKL\MNSP\'+ @@servername+'\AL.txt'
November 6, 2019 at 1:37 am
I tried that . it’s not working
November 6, 2019 at 8:16 am
What didn't work? How are we supposed to help you debug when you don't give us anything to work with?
Perhaps you are looking for the machine name, and not the @@servername
SELECT N'\\ABCD\EFGH\IJKL\MNSP\' + CONVERT( nvarchar(128), SERVERPROPERTY( 'MachineName' )) + N'\AL.txt';
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply