Showing posts with label string. Show all posts
Showing posts with label string. Show all posts

Wednesday, March 21, 2012

ODBC connect string for named instance?

I am familiar with constructing ODBC connect strings for SQL server
databases using "SERVER=" and "Database=" clauses. If the SQL server is
running a named instance, instead of an unnamed one, do you put the instance
name in the "SERVER=" clause, or is there another clause for that?
-Richard M. Hartman
186,000 mi/sec: not just a good idea, it's the LAW!
You have insurance for your car and your health,
why not for your legal needs?
http://www.legalhmo.comI can't test this right now, but you should be able to set SERVER to
servername\instancename.
--
Rick Byham (MSFT)
This posting is provided "AS IS" with no warranties, and confers no rights.
"Richard M. Hartman" <hartman@.onetouch.com> wrote in message
news:%2355fg9unHHA.3544@.TK2MSFTNGP03.phx.gbl...
> I am familiar with constructing ODBC connect strings for SQL server
> databases using "SERVER=" and "Database=" clauses. If the SQL server is
> running a named instance, instead of an unnamed one, do you put the
> instance name in the "SERVER=" clause, or is there another clause for
> that?
> --
> -Richard M. Hartman
> 186,000 mi/sec: not just a good idea, it's the LAW!
> You have insurance for your car and your health,
> why not for your legal needs?
> http://www.legalhmo.com
>

ODBC connect string for named instance?

I am familiar with constructing ODBC connect strings for SQL server
databases using "SERVER=" and "Database=" clauses. If the SQL server is
running a named instance, instead of an unnamed one, do you put the instance
name in the "SERVER=" clause, or is there another clause for that?
-Richard M. Hartman
186,000 mi/sec: not just a good idea, it's the LAW!
You have insurance for your car and your health,
why not for your legal needs?
http://www.legalhmo.com
I can't test this right now, but you should be able to set SERVER to
servername\instancename.
Rick Byham (MSFT)
This posting is provided "AS IS" with no warranties, and confers no rights.
"Richard M. Hartman" <hartman@.onetouch.com> wrote in message
news:%2355fg9unHHA.3544@.TK2MSFTNGP03.phx.gbl...
> I am familiar with constructing ODBC connect strings for SQL server
> databases using "SERVER=" and "Database=" clauses. If the SQL server is
> running a named instance, instead of an unnamed one, do you put the
> instance name in the "SERVER=" clause, or is there another clause for
> that?
> --
> -Richard M. Hartman
> 186,000 mi/sec: not just a good idea, it's the LAW!
> You have insurance for your car and your health,
> why not for your legal needs?
> http://www.legalhmo.com
>

ODBC Connect Failure for SQL 2005

The ado connect string for SQL 2K is: strConnect = "driver={SQL
Server};server=" & ServerName & ";database= "yada yada yada".
What do I need to change to connect to SQL 2005 with the SQL Native Client?
Thanks in advance
Steve House
olorin@.tampabay.rr.comBTW, Currently, I am using VB6 to code, though I plan to use VB 2005 and
ASP.Net 2.0
"Steve House" <olorin@.tampabay.rr.com> wrote in message
news:Oze9v5UpFHA.3516@.TK2MSFTNGP15.phx.gbl...
> The ado connect string for SQL 2K is: strConnect = "driver={SQL
> Server};server=" & ServerName & ";database= "yada yada yada".
> What do I need to change to connect to SQL 2005 with the SQL Native
> Client?
> Thanks in advance
> Steve House
> olorin@.tampabay.rr.com
>|||Hi
You should be using the OLEDB for ASP by now too.
sConn = "Provider='SQLOLEDB';Data Source='MySqlServer';Initial
Catalog='TempDB';Integrated Security='SSPI';"
{sqlserver} is the ODBC driver.
SQLOLEDB will work for SQL Server 2000 and 2005.
SQL CLI:
sConn = "Provider='SQLNCLI';Data Source='MySqlServer';Initial
Catalog='TempDB';Integrated Security='SSPI';"
SQL Server 2005 questions to
http://communities.microsoft.com/ne...lcid=us

Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Steve House" <olorin@.tampabay.rr.com> wrote in message
news:O86CaAVpFHA.1088@.TK2MSFTNGP14.phx.gbl...
> BTW, Currently, I am using VB6 to code, though I plan to use VB 2005 and
> ASP.Net 2.0
> "Steve House" <olorin@.tampabay.rr.com> wrote in message
> news:Oze9v5UpFHA.3516@.TK2MSFTNGP15.phx.gbl...
>|||Hello,
For questions of SQL server 2005, please post at the following newsgroup:
Welcome to the Microsoft SQL Server 2005 Community Technology (CTP)
Newsgroups
<http://communities.microsoft.com/ne...sqlserver2005&s
lcid=us>
Thanks for cooperation.
Sophie Guo
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
========================================
=============
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
=============
This posting is provided "AS IS" with no warranties, and confers no rights.

ODBC Connect Failure for SQL 2005

The ado connect string for SQL 2K is: strConnect = "driver={SQL
Server};server=" & ServerName & ";database= "yada yada yada".
What do I need to change to connect to SQL 2005 with the SQL Native Client?
Thanks in advance
Steve House
olorin@.tampabay.rr.com
BTW, Currently, I am using VB6 to code, though I plan to use VB 2005 and
ASP.Net 2.0
"Steve House" <olorin@.tampabay.rr.com> wrote in message
news:Oze9v5UpFHA.3516@.TK2MSFTNGP15.phx.gbl...
> The ado connect string for SQL 2K is: strConnect = "driver={SQL
> Server};server=" & ServerName & ";database= "yada yada yada".
> What do I need to change to connect to SQL 2005 with the SQL Native
> Client?
> Thanks in advance
> Steve House
> olorin@.tampabay.rr.com
>
|||Hi
You should be using the OLEDB for ASP by now too.
sConn = "Provider='SQLOLEDB';Data Source='MySqlServer';Initial
Catalog='TempDB';Integrated Security='SSPI';"
{sqlserver} is the ODBC driver.
SQLOLEDB will work for SQL Server 2000 and 2005.
SQL CLI:
sConn = "Provider='SQLNCLI';Data Source='MySqlServer';Initial
Catalog='TempDB';Integrated Security='SSPI';"
SQL Server 2005 questions to
http://communities.microsoft.com/new...r2005&slcid=us
Regards
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Steve House" <olorin@.tampabay.rr.com> wrote in message
news:O86CaAVpFHA.1088@.TK2MSFTNGP14.phx.gbl...
> BTW, Currently, I am using VB6 to code, though I plan to use VB 2005 and
> ASP.Net 2.0
> "Steve House" <olorin@.tampabay.rr.com> wrote in message
> news:Oze9v5UpFHA.3516@.TK2MSFTNGP15.phx.gbl...
>
|||Hello,
For questions of SQL server 2005, please post at the following newsgroup:
Welcome to the Microsoft SQL Server 2005 Community Technology (CTP)
Newsgroups
<http://communities.microsoft.com/new...qlserver2005&s
lcid=us>
Thanks for cooperation.
Sophie Guo
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
================================================== ===
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ===
This posting is provided "AS IS" with no warranties, and confers no rights.

Wednesday, March 7, 2012

Obtaining the time from datetime field

From this value: 2002-11-22 00:00:22.000
I want to obtain in string type "00:00:22.000" including miliseconds
I try this but returns: 0:0:22:0
select
Ltrim(Rtrim(CONVERT(CHAR(2), DATEPART(hh,DURACIONULT)))) + ':' +
Ltrim(Rtrim(CONVERT(CHAR(2), DATEPART(mi,DURACIONULT)))) + ':' +
Ltrim(Rtrim(CONVERT(CHAR(3), DATEPART(ss,DURACIONULT)))) + ':' +
Ltrim(Rtrim(CONVERT(CHAR(3), DATEPART(ms,duracionult))))
from cargaprocesos
Can you help me?
Thanks a lot,Enric, try:
convert(varchar(12), dt, 114)
BG, SQL Server MVP
www.SolidQualityLearning.com
"Enric" wrote:

> From this value: 2002-11-22 00:00:22.000
> I want to obtain in string type "00:00:22.000" including miliseconds
> I try this but returns: 0:0:22:0
> select
> Ltrim(Rtrim(CONVERT(CHAR(2), DATEPART(hh,DURACIONULT)))) + ':' +
> Ltrim(Rtrim(CONVERT(CHAR(2), DATEPART(mi,DURACIONULT)))) + ':' +
> Ltrim(Rtrim(CONVERT(CHAR(3), DATEPART(ss,DURACIONULT)))) + ':' +
> Ltrim(Rtrim(CONVERT(CHAR(3), DATEPART(ms,duracionult))))
> from cargaprocesos
> Can you help me?
> Thanks a lot,|||You should go with that:
Select Convert(varchar(12), GETDATE(), 114)
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
--
"Enric" wrote:

> From this value: 2002-11-22 00:00:22.000
> I want to obtain in string type "00:00:22.000" including miliseconds
> I try this but returns: 0:0:22:0
> select
> Ltrim(Rtrim(CONVERT(CHAR(2), DATEPART(hh,DURACIONULT)))) + ':' +
> Ltrim(Rtrim(CONVERT(CHAR(2), DATEPART(mi,DURACIONULT)))) + ':' +
> Ltrim(Rtrim(CONVERT(CHAR(3), DATEPART(ss,DURACIONULT)))) + ':' +
> Ltrim(Rtrim(CONVERT(CHAR(3), DATEPART(ms,duracionult))))
> from cargaprocesos
> Can you help me?
> Thanks a lot,|||Thanks Itzik, I had tried this:
select substring(convert(varchar(50),duracionul
t,113),13,12),
duracionult
from cargaprocesos
But it was failing.
regards,
"Itzik Ben-Gan" wrote:
> Enric, try:
> convert(varchar(12), dt, 114)
> --
> BG, SQL Server MVP
> www.SolidQualityLearning.com
>
> "Enric" wrote:
>|||A disign suggestion:
I would create a function for this logic.
Makes the code more readable and it makes the logic reusable aswell.
Hope this is helpfull.
Marcel van Eijkel
( www.vaneijkel.com )