what is the SQL to find
1) current database
2) server name
like one can do in Oracle like:
select user from dua;
select * from v$instance;
thanksklabu wrote:
> what is the SQL to find
> 1) current database
> 2) server name
> like one can do in Oracle like:
> select user from dua;
> select * from v$instance;
>
> thanks
SELECT DB_NAME() AS db_name;
SELECT SERVERPROPERTY('MachineName') AS MachineName;
SELECT SERVERPROPERTY('InstanceName') AS InstanceName;
SELECT SERVERPROPERTY('ServerName') AS ServerName;
--
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--|||thanks
how to concat them values ?
>> SELECT DB_NAME () + SERVERPROPERTY('ServerName') AS db_on_server;|||klabu wrote:
>thanks
>how to concat them values ?
>> SELECT DB_NAME () + SERVERPROPERTY('ServerName') AS db_on_server;
Select @.@.Servername returns current server as well.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment