Friday, March 9, 2012

localhost

i have a path line in my code, now, i have in the path \\"computername"\sharename\... what i need to do is instead of the "computername", i need to put a variable there to pick the localhost name where the code is runing on.If you're not running a named instance, you could use
declare @.path varchar(255)
select @.path = @.@.servername + '\\sharename'
select @.path
"IT" <anonymous@.discussions.microsoft.com> wrote in message
news:25BA2799-65BB-467A-8F46-39F732B0FB36@.microsoft.com...
> i have a path line in my code, now, i have in the path
\\"computername"\sharename\... what i need to do is instead of the
"computername", i need to put a variable there to pick the localhost name
where the code is runing on.|||SQL Server should handle the word localhost and/or (local) for the server name. Did you try that? If
you want to extract the machine name, you can use the SERVERPROPERTY function (read about it in
Books Online).
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"IT" <anonymous@.discussions.microsoft.com> wrote in message
news:25BA2799-65BB-467A-8F46-39F732B0FB36@.microsoft.com...
> i have a path line in my code, now, i have in the path \\"computername"\sharename\... what i need
to do is instead of the "computername", i need to put a variable there to pick the localhost name
where the code is runing on.

No comments:

Post a Comment