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
 General SQL Server Forums
 New to SQL Server Programming
 Data Source = . ?

Author  Topic 

Darrell.J.Elliott
Starting Member

3 Posts

Posted - 2012-08-15 : 14:36:03
Hello,

I'm working with some other programmers and they have used a connection string that I haven't seen before. Can someone explain to me why/how this works for a connection string?

Data Source=.;Initial Catalog=<database name>

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-08-15 : 14:43:51
It denotes a "User Instance" - see here: http://msdn.microsoft.com/en-us/library/ms143684(v=sql.100).aspx

However, I have no direct experience with it, and when I have run into it, it always has been of the form "Data Source=.\SQLExpress" i.e., creating local instance of SQL Express.
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2012-08-15 : 14:46:24
. and (local) should be interchangeable. I tend to use (local) instead of . for conenction strings and I think it it more obvious. But, you can also try it out by opening SSMS and connecting to a database engine and enter . for the server name (assuming you have a local default instance).
Go to Top of Page

Darrell.J.Elliott
Starting Member

3 Posts

Posted - 2012-08-15 : 14:47:56
Thanks for the link, I will start reading it. Like you, I have only seen something like this when connecting to SQLExpress as well. Curious...
Go to Top of Page

Darrell.J.Elliott
Starting Member

3 Posts

Posted - 2012-08-15 : 14:49:25
@Lamprey, thanks for the input on that. I do agree with you, using (local) definitely makes more sense! Cheers!
Go to Top of Page
   

- Advertisement -