I have the following problem. My SQL Query that i wrote works but the result that is displayed in Query analyzer cuts most of my long text that I want in my result. The long text string is approx about 400 characters and the type is varchar of the field. Any ideas??
SELECT '510', PRODCLASSID
, '1', COMPONENTID,'ENG'+SPACE(2),'#'+SPACE(254),'#'+SPAC E(254),'#'+SPACE(254),'#'+SPACE(99),externalid,
'Desc1' = CASE
WHEN SUBSTRING(externalid,1,2) = 'MF'
THEN 'Full machine warranty : parts, labour, mileage and others covered at warranty rates applicable at the time of repair. '
WHEN SUBSTRING(externalid,1,2) = 'MP'
THEN 'Full machine warranty, parts only : parts covered at warranty rates applicable at the time of repair. '
WHEN SUBSTRING(externalid,1,2) = 'PF'
THEN 'Power line warranty : parts, labour, mileage and others covered at warranty rates applicable at the time of repair. '
WHEN SUBSTRING(externalid,1,2) = 'PP'
THEN 'Power line warranty, parts only : parts are covered at warranty rates applicable at the time of repair. '
END
+
CASE
WHEN SUBSTRING(externalid,LEN(externalid)- 3,4) = '2018'
THEN 'Flexible warranty starts after the standard warranty period has expired and is covered up to 18 month or 2000 HRS, whichever comes first. '
WHEN SUBSTRING(externalid,LEN(externalid)-3,4) = '3024'
THEN 'Flexible warranty starts after the standard warranty period has expired and is covered up to 24 month or 3000 HRS, whichever comes first. '
WHEN SUBSTRING(externalid,LEN(externalid)-3,4) = '4030'
THEN 'Flexible warranty starts after the standard warranty period has expired and is covered up to 30 month or 4000 HRS, whichever comes first. '
WHEN SUBSTRING(externalid,LEN(externalid)-3,4) = '5036'
THEN 'Flexible warranty starts after the standard warranty period has expired and is covered up to 36 month or 5000 HRS, whichever comes first. '
WHEN SUBSTRING(externalid,LEN(externalid)-3,4) = '6042'
THEN 'Flexible warranty starts after the standard warranty period has expired and is covered up to 42 month or 6000 HRS, whichever comes first. '
WHEN SUBSTRING(externalid,LEN(externalid)-3,4) = '8054'
THEN 'Flexible warranty starts after the standard warranty period has expired and is covered up to 54 month or 8000 HRS, whichever comes first. '
WHEN SUBSTRING(externalid,LEN(externalid)-3,4) = '1074'
THEN 'Flexible warranty starts after the standard warranty period has expired and is covered up to 74 month or 10000 HRS, whichever comes first. '
END
+ 'Flexible warranty is handled according to the procedures described in ESPPM 3-10.'
+
CASE
WHEN prodclassid IN ('P1','P11','P8','P9')
THEN ' (mileage limited to 300 km)'
WHEN prodclassid IN ('P7')
THEN ' (mileage limited to 200 km)'
ELSE NULL
END
+
SPACE(5000 - LEN('Desc1'))
......If you are using the MS Query Analyzer from the SQL 2000 Client Tools, you can set the maximum column length. Select Tools | Options | Results and the length control is near the middle of the sheet.
-PatPsql
Showing posts with label characters. Show all posts
Showing posts with label characters. Show all posts
Thursday, March 29, 2012
Monday, March 19, 2012
DMO SQLServer->Connect failed for user name with special characters
Hi,
If I give a user name or password having special character (mainly
semi-colon) then I cannot connect to the SQL Server. Following is the error:
Login failed for user 'a`~!@.#$%^&*()_+|-=[]'.
TCP Provider: An existing connection was forcibly closed by the
remote host.
Communication link failure
Invalid connection string attribute
However, this error was coming in my Cpp code. I tried with VB, I
works. Also, I got same error from Enterprise Manager.
Is this a defect or known behavior in DMO?
TIA,
AjeyActual user name was a`~!@.#$%^&*()_+|-=[];',./{}:"<>?
"Ajey" <ajey5@.hotmail.com> wrote in message
news:ujnaqXcjFHA.1428@.TK2MSFTNGP10.phx.gbl...
> Hi,
> If I give a user name or password having special character (mainly
> semi-colon) then I cannot connect to the SQL Server. Following is the
> error:
> Login failed for user 'a`~!@.#$%^&*()_+|-=[]'.
> TCP Provider: An existing connection was forcibly closed by the
> remote host.
> Communication link failure
> Invalid connection string attribute
> However, this error was coming in my Cpp code. I tried with VB, I
> works. Also, I got same error from Enterprise Manager.
> Is this a defect or known behavior in DMO?
>
> TIA,
> Ajey
>|||/ is an escape character in cpp, you have to replace / with // in your
string for it to work properly.
hth
--
Vikram Vamshi
Database Engineer
Eclipsys Corporation
"Ajey" <ajey5@.hotmail.com> wrote in message
news:OqwRXccjFHA.3316@.TK2MSFTNGP14.phx.gbl...
> Actual user name was a`~!@.#$%^&*()_+|-=[];',./{}:"<>?
> "Ajey" <ajey5@.hotmail.com> wrote in message
> news:ujnaqXcjFHA.1428@.TK2MSFTNGP10.phx.gbl...
>|||I think it's mainly due to semi-colon. The error message displays the user
names till the character before the semi-colon. Also, same username &
password does not work while registering the sql server using Enterprise
Manager or connecting through Query Analyser.
- Ajey
"Vikram Vamshi" <vikram.vamshi@.online.eclipsys.com> wrote in message
news:uMKZSCkjFHA.3900@.TK2MSFTNGP10.phx.gbl...
>/ is an escape character in cpp, you have to replace / with // in your
>string for it to work properly.
> hth
> --
> Vikram Vamshi
> Database Engineer
> Eclipsys Corporation
> "Ajey" <ajey5@.hotmail.com> wrote in message
> news:OqwRXccjFHA.3316@.TK2MSFTNGP14.phx.gbl...
>|||Can you post your cpp code that can reproduce the issue?
Vikram Vamshi
Database Engineer
Eclipsys Corporation
"Ajey" <ajey5@.hotmail.com> wrote in message
news:uZXxuFojFHA.2644@.TK2MSFTNGP09.phx.gbl...
>I think it's mainly due to semi-colon. The error message displays the user
>names till the character before the semi-colon. Also, same username &
>password does not work while registering the sql server using Enterprise
>Manager or connecting through Query Analyser.
> - Ajey
> "Vikram Vamshi" <vikram.vamshi@.online.eclipsys.com> wrote in message
> news:uMKZSCkjFHA.3900@.TK2MSFTNGP10.phx.gbl...
>|||Also try to put quotes around the user name (try both single quotes and
double quotes, one of them should be able to handle special characters)
hth
Vikram Vamshi
Database Engineer
Eclipsys Corporation
"Ajey" <ajey5@.hotmail.com> wrote in message
news:uZXxuFojFHA.2644@.TK2MSFTNGP09.phx.gbl...
>I think it's mainly due to semi-colon. The error message displays the user
>names till the character before the semi-colon. Also, same username &
>password does not work while registering the sql server using Enterprise
>Manager or connecting through Query Analyser.
> - Ajey
> "Vikram Vamshi" <vikram.vamshi@.online.eclipsys.com> wrote in message
> news:uMKZSCkjFHA.3900@.TK2MSFTNGP10.phx.gbl...
>|||strSQLLoginName = L"abc;xyz"
strSQLLoginPassword = L"abc"
HRESULT hrConnect = spServer->Connect( rkstrCurrentServerName.c_str(),
strSQLLoginName.c_str(), strSQLLoginPassword.c_str() );
This code also gives the same error. Also, if i paste user name as abc;xyz
in Enterprise Manager or Query Analyzer I get the same error.
The same thing works with ADO. I had to just escape the special characters
in the connection string. While can pass the username & password directly to
the ADOConnection->Connect() method. But same is not working on DMO.
Thanks.
- Ajey
"Vikram Vamshi" <vikram.vamshi@.online.eclipsys.com> wrote in message
news:OrYsYoujFHA.3316@.TK2MSFTNGP14.phx.gbl...
> Also try to put quotes around the user name (try both single quotes and
> double quotes, one of them should be able to handle special characters)
> hth
> --
> Vikram Vamshi
> Database Engineer
> Eclipsys Corporation
> "Ajey" <ajey5@.hotmail.com> wrote in message
> news:uZXxuFojFHA.2644@.TK2MSFTNGP09.phx.gbl...
>
If I give a user name or password having special character (mainly
semi-colon) then I cannot connect to the SQL Server. Following is the error:
Login failed for user 'a`~!@.#$%^&*()_+|-=[]'.
TCP Provider: An existing connection was forcibly closed by the
remote host.
Communication link failure
Invalid connection string attribute
However, this error was coming in my Cpp code. I tried with VB, I
works. Also, I got same error from Enterprise Manager.
Is this a defect or known behavior in DMO?
TIA,
AjeyActual user name was a`~!@.#$%^&*()_+|-=[];',./{}:"<>?
"Ajey" <ajey5@.hotmail.com> wrote in message
news:ujnaqXcjFHA.1428@.TK2MSFTNGP10.phx.gbl...
> Hi,
> If I give a user name or password having special character (mainly
> semi-colon) then I cannot connect to the SQL Server. Following is the
> error:
> Login failed for user 'a`~!@.#$%^&*()_+|-=[]'.
> TCP Provider: An existing connection was forcibly closed by the
> remote host.
> Communication link failure
> Invalid connection string attribute
> However, this error was coming in my Cpp code. I tried with VB, I
> works. Also, I got same error from Enterprise Manager.
> Is this a defect or known behavior in DMO?
>
> TIA,
> Ajey
>|||/ is an escape character in cpp, you have to replace / with // in your
string for it to work properly.
hth
--
Vikram Vamshi
Database Engineer
Eclipsys Corporation
"Ajey" <ajey5@.hotmail.com> wrote in message
news:OqwRXccjFHA.3316@.TK2MSFTNGP14.phx.gbl...
> Actual user name was a`~!@.#$%^&*()_+|-=[];',./{}:"<>?
> "Ajey" <ajey5@.hotmail.com> wrote in message
> news:ujnaqXcjFHA.1428@.TK2MSFTNGP10.phx.gbl...
>|||I think it's mainly due to semi-colon. The error message displays the user
names till the character before the semi-colon. Also, same username &
password does not work while registering the sql server using Enterprise
Manager or connecting through Query Analyser.
- Ajey
"Vikram Vamshi" <vikram.vamshi@.online.eclipsys.com> wrote in message
news:uMKZSCkjFHA.3900@.TK2MSFTNGP10.phx.gbl...
>/ is an escape character in cpp, you have to replace / with // in your
>string for it to work properly.
> hth
> --
> Vikram Vamshi
> Database Engineer
> Eclipsys Corporation
> "Ajey" <ajey5@.hotmail.com> wrote in message
> news:OqwRXccjFHA.3316@.TK2MSFTNGP14.phx.gbl...
>|||Can you post your cpp code that can reproduce the issue?
Vikram Vamshi
Database Engineer
Eclipsys Corporation
"Ajey" <ajey5@.hotmail.com> wrote in message
news:uZXxuFojFHA.2644@.TK2MSFTNGP09.phx.gbl...
>I think it's mainly due to semi-colon. The error message displays the user
>names till the character before the semi-colon. Also, same username &
>password does not work while registering the sql server using Enterprise
>Manager or connecting through Query Analyser.
> - Ajey
> "Vikram Vamshi" <vikram.vamshi@.online.eclipsys.com> wrote in message
> news:uMKZSCkjFHA.3900@.TK2MSFTNGP10.phx.gbl...
>|||Also try to put quotes around the user name (try both single quotes and
double quotes, one of them should be able to handle special characters)
hth
Vikram Vamshi
Database Engineer
Eclipsys Corporation
"Ajey" <ajey5@.hotmail.com> wrote in message
news:uZXxuFojFHA.2644@.TK2MSFTNGP09.phx.gbl...
>I think it's mainly due to semi-colon. The error message displays the user
>names till the character before the semi-colon. Also, same username &
>password does not work while registering the sql server using Enterprise
>Manager or connecting through Query Analyser.
> - Ajey
> "Vikram Vamshi" <vikram.vamshi@.online.eclipsys.com> wrote in message
> news:uMKZSCkjFHA.3900@.TK2MSFTNGP10.phx.gbl...
>|||strSQLLoginName = L"abc;xyz"
strSQLLoginPassword = L"abc"
HRESULT hrConnect = spServer->Connect( rkstrCurrentServerName.c_str(),
strSQLLoginName.c_str(), strSQLLoginPassword.c_str() );
This code also gives the same error. Also, if i paste user name as abc;xyz
in Enterprise Manager or Query Analyzer I get the same error.
The same thing works with ADO. I had to just escape the special characters
in the connection string. While can pass the username & password directly to
the ADOConnection->Connect() method. But same is not working on DMO.
Thanks.
- Ajey
"Vikram Vamshi" <vikram.vamshi@.online.eclipsys.com> wrote in message
news:OrYsYoujFHA.3316@.TK2MSFTNGP14.phx.gbl...
> Also try to put quotes around the user name (try both single quotes and
> double quotes, one of them should be able to handle special characters)
> hth
> --
> Vikram Vamshi
> Database Engineer
> Eclipsys Corporation
> "Ajey" <ajey5@.hotmail.com> wrote in message
> news:uZXxuFojFHA.2644@.TK2MSFTNGP09.phx.gbl...
>
DMO SQLServer->Connect failed for user name with special characters
Hi,
If I give a user name or password having special character (mainly
semi-colon) then I cannot connect to the SQL Server. Following is the error:
Login failed for user 'a`~!@.#$%^&*()_+|-=[]'.
TCP Provider: An existing connection was forcibly closed by the
remote host.
Communication link failure
Invalid connection string attribute
However, this error was coming in my Cpp code. I tried with VB, I
works. Also, I got same error from Enterprise Manager.
Is this a defect or known behavior in DMO?
TIA,
Ajey
Actual user name was a`~!@.#$%^&*()_+|-=[];',./{}:"<>?
"Ajey" <ajey5@.hotmail.com> wrote in message
news:ujnaqXcjFHA.1428@.TK2MSFTNGP10.phx.gbl...
> Hi,
> If I give a user name or password having special character (mainly
> semi-colon) then I cannot connect to the SQL Server. Following is the
> error:
> Login failed for user 'a`~!@.#$%^&*()_+|-=[]'.
> TCP Provider: An existing connection was forcibly closed by the
> remote host.
> Communication link failure
> Invalid connection string attribute
> However, this error was coming in my Cpp code. I tried with VB, I
> works. Also, I got same error from Enterprise Manager.
> Is this a defect or known behavior in DMO?
>
> TIA,
> Ajey
>
|||/ is an escape character in cpp, you have to replace / with // in your
string for it to work properly.
hth
Vikram Vamshi
Database Engineer
Eclipsys Corporation
"Ajey" <ajey5@.hotmail.com> wrote in message
news:OqwRXccjFHA.3316@.TK2MSFTNGP14.phx.gbl...
> Actual user name was a`~!@.#$%^&*()_+|-=[];',./{}:"<>?
> "Ajey" <ajey5@.hotmail.com> wrote in message
> news:ujnaqXcjFHA.1428@.TK2MSFTNGP10.phx.gbl...
>
|||I think it's mainly due to semi-colon. The error message displays the user
names till the character before the semi-colon. Also, same username &
password does not work while registering the sql server using Enterprise
Manager or connecting through Query Analyser.
- Ajey
"Vikram Vamshi" <vikram.vamshi@.online.eclipsys.com> wrote in message
news:uMKZSCkjFHA.3900@.TK2MSFTNGP10.phx.gbl...
>/ is an escape character in cpp, you have to replace / with // in your
>string for it to work properly.
> hth
> --
> Vikram Vamshi
> Database Engineer
> Eclipsys Corporation
> "Ajey" <ajey5@.hotmail.com> wrote in message
> news:OqwRXccjFHA.3316@.TK2MSFTNGP14.phx.gbl...
>
|||Can you post your cpp code that can reproduce the issue?
Vikram Vamshi
Database Engineer
Eclipsys Corporation
"Ajey" <ajey5@.hotmail.com> wrote in message
news:uZXxuFojFHA.2644@.TK2MSFTNGP09.phx.gbl...
>I think it's mainly due to semi-colon. The error message displays the user
>names till the character before the semi-colon. Also, same username &
>password does not work while registering the sql server using Enterprise
>Manager or connecting through Query Analyser.
> - Ajey
> "Vikram Vamshi" <vikram.vamshi@.online.eclipsys.com> wrote in message
> news:uMKZSCkjFHA.3900@.TK2MSFTNGP10.phx.gbl...
>
|||Also try to put quotes around the user name (try both single quotes and
double quotes, one of them should be able to handle special characters)
hth
Vikram Vamshi
Database Engineer
Eclipsys Corporation
"Ajey" <ajey5@.hotmail.com> wrote in message
news:uZXxuFojFHA.2644@.TK2MSFTNGP09.phx.gbl...
>I think it's mainly due to semi-colon. The error message displays the user
>names till the character before the semi-colon. Also, same username &
>password does not work while registering the sql server using Enterprise
>Manager or connecting through Query Analyser.
> - Ajey
> "Vikram Vamshi" <vikram.vamshi@.online.eclipsys.com> wrote in message
> news:uMKZSCkjFHA.3900@.TK2MSFTNGP10.phx.gbl...
>
|||strSQLLoginName = L"abc;xyz"
strSQLLoginPassword = L"abc"
HRESULT hrConnect = spServer->Connect( rkstrCurrentServerName.c_str(),
strSQLLoginName.c_str(), strSQLLoginPassword.c_str() );
This code also gives the same error. Also, if i paste user name as abc;xyz
in Enterprise Manager or Query Analyzer I get the same error.
The same thing works with ADO. I had to just escape the special characters
in the connection string. While can pass the username & password directly to
the ADOConnection->Connect() method. But same is not working on DMO.
Thanks.
- Ajey
"Vikram Vamshi" <vikram.vamshi@.online.eclipsys.com> wrote in message
news:OrYsYoujFHA.3316@.TK2MSFTNGP14.phx.gbl...
> Also try to put quotes around the user name (try both single quotes and
> double quotes, one of them should be able to handle special characters)
> hth
> --
> Vikram Vamshi
> Database Engineer
> Eclipsys Corporation
> "Ajey" <ajey5@.hotmail.com> wrote in message
> news:uZXxuFojFHA.2644@.TK2MSFTNGP09.phx.gbl...
>
If I give a user name or password having special character (mainly
semi-colon) then I cannot connect to the SQL Server. Following is the error:
Login failed for user 'a`~!@.#$%^&*()_+|-=[]'.
TCP Provider: An existing connection was forcibly closed by the
remote host.
Communication link failure
Invalid connection string attribute
However, this error was coming in my Cpp code. I tried with VB, I
works. Also, I got same error from Enterprise Manager.
Is this a defect or known behavior in DMO?
TIA,
Ajey
Actual user name was a`~!@.#$%^&*()_+|-=[];',./{}:"<>?
"Ajey" <ajey5@.hotmail.com> wrote in message
news:ujnaqXcjFHA.1428@.TK2MSFTNGP10.phx.gbl...
> Hi,
> If I give a user name or password having special character (mainly
> semi-colon) then I cannot connect to the SQL Server. Following is the
> error:
> Login failed for user 'a`~!@.#$%^&*()_+|-=[]'.
> TCP Provider: An existing connection was forcibly closed by the
> remote host.
> Communication link failure
> Invalid connection string attribute
> However, this error was coming in my Cpp code. I tried with VB, I
> works. Also, I got same error from Enterprise Manager.
> Is this a defect or known behavior in DMO?
>
> TIA,
> Ajey
>
|||/ is an escape character in cpp, you have to replace / with // in your
string for it to work properly.
hth
Vikram Vamshi
Database Engineer
Eclipsys Corporation
"Ajey" <ajey5@.hotmail.com> wrote in message
news:OqwRXccjFHA.3316@.TK2MSFTNGP14.phx.gbl...
> Actual user name was a`~!@.#$%^&*()_+|-=[];',./{}:"<>?
> "Ajey" <ajey5@.hotmail.com> wrote in message
> news:ujnaqXcjFHA.1428@.TK2MSFTNGP10.phx.gbl...
>
|||I think it's mainly due to semi-colon. The error message displays the user
names till the character before the semi-colon. Also, same username &
password does not work while registering the sql server using Enterprise
Manager or connecting through Query Analyser.
- Ajey
"Vikram Vamshi" <vikram.vamshi@.online.eclipsys.com> wrote in message
news:uMKZSCkjFHA.3900@.TK2MSFTNGP10.phx.gbl...
>/ is an escape character in cpp, you have to replace / with // in your
>string for it to work properly.
> hth
> --
> Vikram Vamshi
> Database Engineer
> Eclipsys Corporation
> "Ajey" <ajey5@.hotmail.com> wrote in message
> news:OqwRXccjFHA.3316@.TK2MSFTNGP14.phx.gbl...
>
|||Can you post your cpp code that can reproduce the issue?
Vikram Vamshi
Database Engineer
Eclipsys Corporation
"Ajey" <ajey5@.hotmail.com> wrote in message
news:uZXxuFojFHA.2644@.TK2MSFTNGP09.phx.gbl...
>I think it's mainly due to semi-colon. The error message displays the user
>names till the character before the semi-colon. Also, same username &
>password does not work while registering the sql server using Enterprise
>Manager or connecting through Query Analyser.
> - Ajey
> "Vikram Vamshi" <vikram.vamshi@.online.eclipsys.com> wrote in message
> news:uMKZSCkjFHA.3900@.TK2MSFTNGP10.phx.gbl...
>
|||Also try to put quotes around the user name (try both single quotes and
double quotes, one of them should be able to handle special characters)
hth
Vikram Vamshi
Database Engineer
Eclipsys Corporation
"Ajey" <ajey5@.hotmail.com> wrote in message
news:uZXxuFojFHA.2644@.TK2MSFTNGP09.phx.gbl...
>I think it's mainly due to semi-colon. The error message displays the user
>names till the character before the semi-colon. Also, same username &
>password does not work while registering the sql server using Enterprise
>Manager or connecting through Query Analyser.
> - Ajey
> "Vikram Vamshi" <vikram.vamshi@.online.eclipsys.com> wrote in message
> news:uMKZSCkjFHA.3900@.TK2MSFTNGP10.phx.gbl...
>
|||strSQLLoginName = L"abc;xyz"
strSQLLoginPassword = L"abc"
HRESULT hrConnect = spServer->Connect( rkstrCurrentServerName.c_str(),
strSQLLoginName.c_str(), strSQLLoginPassword.c_str() );
This code also gives the same error. Also, if i paste user name as abc;xyz
in Enterprise Manager or Query Analyzer I get the same error.
The same thing works with ADO. I had to just escape the special characters
in the connection string. While can pass the username & password directly to
the ADOConnection->Connect() method. But same is not working on DMO.
Thanks.
- Ajey
"Vikram Vamshi" <vikram.vamshi@.online.eclipsys.com> wrote in message
news:OrYsYoujFHA.3316@.TK2MSFTNGP14.phx.gbl...
> Also try to put quotes around the user name (try both single quotes and
> double quotes, one of them should be able to handle special characters)
> hth
> --
> Vikram Vamshi
> Database Engineer
> Eclipsys Corporation
> "Ajey" <ajey5@.hotmail.com> wrote in message
> news:uZXxuFojFHA.2644@.TK2MSFTNGP09.phx.gbl...
>
Subscribe to:
Posts (Atom)