Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Server Type via connection string

Author  Topic 

Rashima
Starting Member

7 Posts

Posted - 2010-05-26 : 15:14:27
I have connection string and I want to know which server type is it?

need a query that tells me that its a SQL Server or Oracle or MS Access based on connection string

thanks in advance

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-05-26 : 15:19:56
You can't write a SQL query to look into the connection string. Connection strings aren't visible to the database server. But perhaps I'm misunderstanding your question.

Could you be more clear?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Rashima
Starting Member

7 Posts

Posted - 2010-05-26 : 15:34:39
I have a COM Object and I have only connection string with me and want to know if this connection string is for server type sql server or oracle or ms access ?

I need a sql statement for this.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-05-26 : 15:40:40
To test if it's SQL Server, you can run SELECT @@VERSION. If it succeeds, then you know it's SQL Server.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Rashima
Starting Member

7 Posts

Posted - 2010-05-27 : 03:05:58
select substr(Banner,1,7) from sys.V_$VERSION where rownum < 2
Return--> Oracle

I need same for SQL Server
what I need is
querys to identify which database is behind a connection, and what it contains
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-05-27 : 03:40:02
quote:
Originally posted by Rashima

select substr(Banner,1,7) from sys.V_$VERSION where rownum < 2
Return--> Oracle

I need same for SQL Server
what I need is
querys to identify which database is behind a connection, and what it contains


select left(@@VERSION,20)

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Rashima
Starting Member

7 Posts

Posted - 2010-05-27 : 03:58:30
Thanks a lot for your answer but still I am far from my search
select left(@@VERSION,20) gives SQL Server
select substr(Banner,1,7) from sys.V_$VERSION where rownum < 2 gives Oracle

But I need a sql where I pass connection string and it tells me server type,database,and what it contains ?
thanks in advance.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-05-27 : 05:04:33
quote:
Originally posted by Rashima

Thanks a lot for your answer but still I am far from my search
select left(@@VERSION,20) gives SQL Server
select substr(Banner,1,7) from sys.V_$VERSION where rownum < 2 gives Oracle

But I need a sql where I pass connection string and it tells me server type,database,and what it contains ?
thanks in advance.



Can you post some sample connection strings?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Rashima
Starting Member

7 Posts

Posted - 2010-05-28 : 02:35:47
Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;

So I have this and would like to have result "SQL SERVER"
Go to Top of Page

Rashima
Starting Member

7 Posts

Posted - 2010-05-28 : 02:56:10
Also want to know depend
Given the name of a VIEW, find out the view/tables it depends on in sqlserver,oracle and in ms access

thanks a lot for help.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-05-28 : 02:59:06
quote:
Originally posted by Rashima

Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;

So I have this and would like to have result "SQL SERVER"


Only way I can think of is if you have "Initial Catalog" as part of the connection string it is SQL Server. For ACCESS, it will have JET.
So based on the text available you can find it

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Rashima
Starting Member

7 Posts

Posted - 2010-06-18 : 02:51:23
select left(@@VERSION,20) gives SQL Server
select substr(Banner,1,7) from sys.V_$VERSION where rownum < 2 gives Oracle
what is the sql for MSAccess ?
Go to Top of Page
   

- Advertisement -