I need to make a function for coding string in which i make difference
between strings that are identical except from final blank spaces. In SQL 20
0
exists an option (collate set or something else) that can make SQL
distinguish betwene two string like these:
'MYSTRING1'
'MTSTRING1 '
ThanksOne method...
if(cast('as ' as varbinary) = cast('as' as varbinary))
print 'match'
else
print 'does not match'
-Omnibuzz (The SQL GC)
http://omnibuzz-sql.blogspot.com/|||Try this:
USE tempdb
GO
CREATE FUNCTION MyStringCompare(@.str1 nvarchar(MAX), @.str2 nvarchar(MAX))
RETURNS nvarchar(15)
AS
BEGIN
IF ((@.str1 + N'#') = (@.str2 + N'#'))
RETURN N'match'
RETURN N'don''t match'
END
GO
SELECT tempdb.dbo.MyStringCompare(N'MYSTRING1', N'MYSTRING1') -- -> match
SELECT tempdb.dbo.MyStringCompare(N'MYSTRING1', N'MYSTRING1 ') -- -> don't
match
SELECT tempdb.dbo.MyStringCompare(null, N'MYSTRING1 ') -- -> don't match
SELECT tempdb.dbo.MyStringCompare(N'MYSTRING1', null) -- -> don't match
SELECT tempdb.dbo.MyStringCompare(null, null) -- -> don't match
Greetings,
Urs
"checcouno" wrote:
> I need to make a function for coding string in which i make difference
> between strings that are identical except from final blank spaces. In SQL
200
> exists an option (collate set or something else) that can make SQL
> distinguish betwene two string like these:
> 'MYSTRING1'
> 'MTSTRING1 '
> Thanks|||How about this:
declare @.a varchar(30)
declare @.b varchar(30)
set @.a = 'MYSTRING1'
set @.b = 'MTSTRING1 '
IF (@.a = @.b AND DATALENGTH(@.a) = DATALENGTH(@.b))
PRINT 'Matched'
ELSE
PRINT 'Different'
Roy Harvey
Beacon Falls, CT
On Fri, 30 Jun 2006 00:26:01 -0700, checcouno
<checcouno@.discussions.microsoft.com> wrote:
>I need to make a function for coding string in which i make difference
>between strings that are identical except from final blank spaces. In SQL 2
00
>exists an option (collate set or something else) that can make SQL
>distinguish betwene two string like these:
>'MYSTRING1'
>'MTSTRING1 '
>Thanks|||>> I need to make a function for coding string in which make difference betw
een strings that are identical except from final blank spaces. <<
Be very careful about this. SQL pads shorter strings with blanks for
comparing them, so your function could destroy expected behavior and
you would wind up with your own private language. Otherwise, use the
DATALENGTH() function; it is standard and portable.
Showing posts with label identical. Show all posts
Showing posts with label identical. Show all posts
Tuesday, March 27, 2012
Sunday, March 25, 2012
Connectivity Problem for Expert
Hi All,
I have an intriguing problem and I wanted to see if somebody could help me.
ENVIRONMENT:
Server Side: 2 identical Windows servers 2000 with SQL Server 2000
Enterprise Edition SP3a
Client Side: workstation with Windows 2000 PRO
Protocols enabled in the server and client: TCP/IP and Named Pipes.
1) I create a new user in the domain, DM001\testesql
2) I create a new login in the SQL Server (one in each SQL Server). For
this, I used script below:
EXEC sp_grantlogin 'DM001\testesql'
GO
EXEC sp_defaultdb 'DM001\testesql', 'Pubs'
GO
USE Pubs
GO
EXEC sp_grantdbaccess 'DM001\testesql', 'testesql'
GO
EXEC sp_addrolemember 'db_owner', 'testesql'
GO
sp_helpuser
THE PROBLEM:
After this, I connected myself in one workstation with the new user of
domain (DM001\testesql)and try a connection via osql utility using the
command line below. Well, in 1 server the connection was made successfully
and got the waited result, but in the other server I received the error:
Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection.
Comand line for SQLServer1 ==> successfully
C:\osql - SSQLServer1 - and - Q"select TOP 1 au_lname, au_fname from
pubs..authors".
--Result:
au_lname au_fname
--- --
Bennet Abraham
(1 row(s) affected)
Comand line for SQLServer2 ==> failed
C:\osql - SSQLServer2 - and - Q"select TOP 1 au_lname, au_fname from
pubs..authors".
Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection.
Please, somebody has idea of that can be happening?
Thx
Nilton Pinheiro
Message posted via http://www.droptable.com
Sorry... SQL Server is set up to use Mixed Mode Authentication in both the
servers.
Thx
Nilton
Message posted via http://www.droptable.com
|||Hi... I solve this problem change permission in Local Policy
thx
Message posted via http://www.droptable.com
|||If you try to connect to a SQL Server using windows
authentication and the error is:
Login failed for user '(null)'.
this generally indicates that the user can't be validated
through the domain controller or the local security database
so null is passed to SQL Server. So it's generally
indicative of an issue with the account, access to the
domain controller or something along those lines.
Check the event logs on the client PC and look for any
network, domain related issues. Check the event logs on the
DC as well.
-Sue
On Wed, 04 May 2005 20:33:12 GMT, "Nilton Pinheiro via
droptable.com" <forum@.nospam.droptable.com> wrote:
>Hi All,
>I have an intriguing problem and I wanted to see if somebody could help me.
>ENVIRONMENT:
>Server Side: 2 identical Windows servers 2000 with SQL Server 2000
>Enterprise Edition SP3a
>Client Side: workstation with Windows 2000 PRO
>Protocols enabled in the server and client: TCP/IP and Named Pipes.
>1) I create a new user in the domain, DM001\testesql
>2) I create a new login in the SQL Server (one in each SQL Server). For
>this, I used script below:
>EXEC sp_grantlogin 'DM001\testesql'
>GO
>EXEC sp_defaultdb 'DM001\testesql', 'Pubs'
>GO
>USE Pubs
>GO
>EXEC sp_grantdbaccess 'DM001\testesql', 'testesql'
>GO
>EXEC sp_addrolemember 'db_owner', 'testesql'
>GO
>sp_helpuser
>
>THE PROBLEM:
>After this, I connected myself in one workstation with the new user of
>domain (DM001\testesql)and try a connection via osql utility using the
>command line below. Well, in 1 server the connection was made successfully
>and got the waited result, but in the other server I received the error:
>Login failed for user '(null)'. Reason: Not associated with a trusted SQL
>Server connection.
>Comand line for SQLServer1 ==> successfully
>C:\osql - SSQLServer1 - and - Q"select TOP 1 au_lname, au_fname from
>pubs..authors".
>--Result:
>au_lname au_fname
>--- --
>Bennet Abraham
>(1 row(s) affected)
>Comand line for SQLServer2 ==> failed
>C:\osql - SSQLServer2 - and - Q"select TOP 1 au_lname, au_fname from
>pubs..authors".
>Login failed for user '(null)'. Reason: Not associated with a trusted SQL
>Server connection.
>Please, somebody has idea of that can be happening?
>Thx
>Nilton Pinheiro
|||Hi Nilton,
I am having similar issue, can you share what steps you followed to resolve
this issue.
--Manoj
"Nilton Pinheiro via droptable.com" wrote:
> Hi... I solve this problem change permission in Local Policy
> thx
> --
> Message posted via http://www.droptable.com
>
I have an intriguing problem and I wanted to see if somebody could help me.
ENVIRONMENT:
Server Side: 2 identical Windows servers 2000 with SQL Server 2000
Enterprise Edition SP3a
Client Side: workstation with Windows 2000 PRO
Protocols enabled in the server and client: TCP/IP and Named Pipes.
1) I create a new user in the domain, DM001\testesql
2) I create a new login in the SQL Server (one in each SQL Server). For
this, I used script below:
EXEC sp_grantlogin 'DM001\testesql'
GO
EXEC sp_defaultdb 'DM001\testesql', 'Pubs'
GO
USE Pubs
GO
EXEC sp_grantdbaccess 'DM001\testesql', 'testesql'
GO
EXEC sp_addrolemember 'db_owner', 'testesql'
GO
sp_helpuser
THE PROBLEM:
After this, I connected myself in one workstation with the new user of
domain (DM001\testesql)and try a connection via osql utility using the
command line below. Well, in 1 server the connection was made successfully
and got the waited result, but in the other server I received the error:
Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection.
Comand line for SQLServer1 ==> successfully
C:\osql - SSQLServer1 - and - Q"select TOP 1 au_lname, au_fname from
pubs..authors".
--Result:
au_lname au_fname
--- --
Bennet Abraham
(1 row(s) affected)
Comand line for SQLServer2 ==> failed
C:\osql - SSQLServer2 - and - Q"select TOP 1 au_lname, au_fname from
pubs..authors".
Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection.
Please, somebody has idea of that can be happening?
Thx
Nilton Pinheiro
Message posted via http://www.droptable.com
Sorry... SQL Server is set up to use Mixed Mode Authentication in both the
servers.
Thx
Nilton
Message posted via http://www.droptable.com
|||Hi... I solve this problem change permission in Local Policy
thx
Message posted via http://www.droptable.com
|||If you try to connect to a SQL Server using windows
authentication and the error is:
Login failed for user '(null)'.
this generally indicates that the user can't be validated
through the domain controller or the local security database
so null is passed to SQL Server. So it's generally
indicative of an issue with the account, access to the
domain controller or something along those lines.
Check the event logs on the client PC and look for any
network, domain related issues. Check the event logs on the
DC as well.
-Sue
On Wed, 04 May 2005 20:33:12 GMT, "Nilton Pinheiro via
droptable.com" <forum@.nospam.droptable.com> wrote:
>Hi All,
>I have an intriguing problem and I wanted to see if somebody could help me.
>ENVIRONMENT:
>Server Side: 2 identical Windows servers 2000 with SQL Server 2000
>Enterprise Edition SP3a
>Client Side: workstation with Windows 2000 PRO
>Protocols enabled in the server and client: TCP/IP and Named Pipes.
>1) I create a new user in the domain, DM001\testesql
>2) I create a new login in the SQL Server (one in each SQL Server). For
>this, I used script below:
>EXEC sp_grantlogin 'DM001\testesql'
>GO
>EXEC sp_defaultdb 'DM001\testesql', 'Pubs'
>GO
>USE Pubs
>GO
>EXEC sp_grantdbaccess 'DM001\testesql', 'testesql'
>GO
>EXEC sp_addrolemember 'db_owner', 'testesql'
>GO
>sp_helpuser
>
>THE PROBLEM:
>After this, I connected myself in one workstation with the new user of
>domain (DM001\testesql)and try a connection via osql utility using the
>command line below. Well, in 1 server the connection was made successfully
>and got the waited result, but in the other server I received the error:
>Login failed for user '(null)'. Reason: Not associated with a trusted SQL
>Server connection.
>Comand line for SQLServer1 ==> successfully
>C:\osql - SSQLServer1 - and - Q"select TOP 1 au_lname, au_fname from
>pubs..authors".
>--Result:
>au_lname au_fname
>--- --
>Bennet Abraham
>(1 row(s) affected)
>Comand line for SQLServer2 ==> failed
>C:\osql - SSQLServer2 - and - Q"select TOP 1 au_lname, au_fname from
>pubs..authors".
>Login failed for user '(null)'. Reason: Not associated with a trusted SQL
>Server connection.
>Please, somebody has idea of that can be happening?
>Thx
>Nilton Pinheiro
|||Hi Nilton,
I am having similar issue, can you share what steps you followed to resolve
this issue.
--Manoj
"Nilton Pinheiro via droptable.com" wrote:
> Hi... I solve this problem change permission in Local Policy
> thx
> --
> Message posted via http://www.droptable.com
>
Labels:
connectivity,
database,
environmentserver,
expert,
identical,
intriguing,
microsoft,
mysql,
oracle,
server,
servers,
somebody,
sql,
windows
Connectivity Problem for Expert
Hi All,
I have an intriguing problem and I wanted to see if somebody could help me.
ENVIRONMENT:
Server Side: 2 identical Windows servers 2000 with SQL Server 2000
Enterprise Edition SP3a
Client Side: workstation with Windows 2000 PRO
Protocols enabled in the server and client: TCP/IP and Named Pipes.
1) I create a new user in the domain, DM001\testesql
2) I create a new login in the SQL Server (one in each SQL Server). For
this, I used script below:
EXEC sp_grantlogin 'DM001\testesql'
GO
EXEC sp_defaultdb 'DM001\testesql', 'Pubs'
GO
USE Pubs
GO
EXEC sp_grantdbaccess 'DM001\testesql', 'testesql'
GO
EXEC sp_addrolemember 'db_owner', 'testesql'
GO
sp_helpuser
THE PROBLEM:
After this, I connected myself in one workstation with the new user of
domain (DM001\testesql)and try a connection via osql utility using the
command line below. Well, in 1 server the connection was made successfully
and got the waited result, but in the other server I received the error:
Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection.
Comand line for SQLServer1 ==> successfully
C:\osql - SSQLServer1 - and - Q"select TOP 1 au_lname, au_fname from
pubs..authors".
--Result:
au_lname au_fname
--- --
Bennet Abraham
(1 row(s) affected)
Comand line for SQLServer2 ==> failed
C:\osql - SSQLServer2 - and - Q"select TOP 1 au_lname, au_fname from
pubs..authors".
Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection.
Please, somebody has idea of that can be happening?
Thx
Nilton Pinheiro
Message posted via http://www.droptable.comSorry... SQL Server is set up to use Mixed Mode Authentication in both the
servers.
Thx
Nilton
Message posted via http://www.droptable.com|||Hi... I solve this problem change permission in Local Policy
thx
Message posted via http://www.droptable.com|||If you try to connect to a SQL Server using windows
authentication and the error is:
Login failed for user '(null)'.
this generally indicates that the user can't be validated
through the domain controller or the local security database
so null is passed to SQL Server. So it's generally
indicative of an issue with the account, access to the
domain controller or something along those lines.
Check the event logs on the client PC and look for any
network, domain related issues. Check the event logs on the
DC as well.
-Sue
On Wed, 04 May 2005 20:33:12 GMT, "Nilton Pinheiro via
droptable.com" <forum@.nospam.droptable.com> wrote:
>Hi All,
>I have an intriguing problem and I wanted to see if somebody could help me.
>ENVIRONMENT:
>Server Side: 2 identical Windows servers 2000 with SQL Server 2000
>Enterprise Edition SP3a
>Client Side: workstation with Windows 2000 PRO
>Protocols enabled in the server and client: TCP/IP and Named Pipes.
>1) I create a new user in the domain, DM001\testesql
>2) I create a new login in the SQL Server (one in each SQL Server). For
>this, I used script below:
>EXEC sp_grantlogin 'DM001\testesql'
>GO
>EXEC sp_defaultdb 'DM001\testesql', 'Pubs'
>GO
>USE Pubs
>GO
>EXEC sp_grantdbaccess 'DM001\testesql', 'testesql'
>GO
>EXEC sp_addrolemember 'db_owner', 'testesql'
>GO
>sp_helpuser
>
>THE PROBLEM:
>After this, I connected myself in one workstation with the new user of
>domain (DM001\testesql)and try a connection via osql utility using the
>command line below. Well, in 1 server the connection was made successfully
>and got the waited result, but in the other server I received the error:
>Login failed for user '(null)'. Reason: Not associated with a trusted SQL
>Server connection.
>Comand line for SQLServer1 ==> successfully
>C:\osql - SSQLServer1 - and - Q"select TOP 1 au_lname, au_fname from
>pubs..authors".
>--Result:
>au_lname au_fname
>--- --
>Bennet Abraham
>(1 row(s) affected)
>Comand line for SQLServer2 ==> failed
>C:\osql - SSQLServer2 - and - Q"select TOP 1 au_lname, au_fname from
>pubs..authors".
>Login failed for user '(null)'. Reason: Not associated with a trusted SQL
>Server connection.
>Please, somebody has idea of that can be happening?
>Thx
>Nilton Pinheiro|||Hi Nilton,
I am having similar issue, can you share what steps you followed to resolve
this issue.
--Manoj
"Nilton Pinheiro via droptable.com" wrote:
> Hi... I solve this problem change permission in Local Policy
> thx
> --
> Message posted via http://www.droptable.com
>
I have an intriguing problem and I wanted to see if somebody could help me.
ENVIRONMENT:
Server Side: 2 identical Windows servers 2000 with SQL Server 2000
Enterprise Edition SP3a
Client Side: workstation with Windows 2000 PRO
Protocols enabled in the server and client: TCP/IP and Named Pipes.
1) I create a new user in the domain, DM001\testesql
2) I create a new login in the SQL Server (one in each SQL Server). For
this, I used script below:
EXEC sp_grantlogin 'DM001\testesql'
GO
EXEC sp_defaultdb 'DM001\testesql', 'Pubs'
GO
USE Pubs
GO
EXEC sp_grantdbaccess 'DM001\testesql', 'testesql'
GO
EXEC sp_addrolemember 'db_owner', 'testesql'
GO
sp_helpuser
THE PROBLEM:
After this, I connected myself in one workstation with the new user of
domain (DM001\testesql)and try a connection via osql utility using the
command line below. Well, in 1 server the connection was made successfully
and got the waited result, but in the other server I received the error:
Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection.
Comand line for SQLServer1 ==> successfully
C:\osql - SSQLServer1 - and - Q"select TOP 1 au_lname, au_fname from
pubs..authors".
--Result:
au_lname au_fname
--- --
Bennet Abraham
(1 row(s) affected)
Comand line for SQLServer2 ==> failed
C:\osql - SSQLServer2 - and - Q"select TOP 1 au_lname, au_fname from
pubs..authors".
Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection.
Please, somebody has idea of that can be happening?
Thx
Nilton Pinheiro
Message posted via http://www.droptable.comSorry... SQL Server is set up to use Mixed Mode Authentication in both the
servers.
Thx
Nilton
Message posted via http://www.droptable.com|||Hi... I solve this problem change permission in Local Policy
thx
Message posted via http://www.droptable.com|||If you try to connect to a SQL Server using windows
authentication and the error is:
Login failed for user '(null)'.
this generally indicates that the user can't be validated
through the domain controller or the local security database
so null is passed to SQL Server. So it's generally
indicative of an issue with the account, access to the
domain controller or something along those lines.
Check the event logs on the client PC and look for any
network, domain related issues. Check the event logs on the
DC as well.
-Sue
On Wed, 04 May 2005 20:33:12 GMT, "Nilton Pinheiro via
droptable.com" <forum@.nospam.droptable.com> wrote:
>Hi All,
>I have an intriguing problem and I wanted to see if somebody could help me.
>ENVIRONMENT:
>Server Side: 2 identical Windows servers 2000 with SQL Server 2000
>Enterprise Edition SP3a
>Client Side: workstation with Windows 2000 PRO
>Protocols enabled in the server and client: TCP/IP and Named Pipes.
>1) I create a new user in the domain, DM001\testesql
>2) I create a new login in the SQL Server (one in each SQL Server). For
>this, I used script below:
>EXEC sp_grantlogin 'DM001\testesql'
>GO
>EXEC sp_defaultdb 'DM001\testesql', 'Pubs'
>GO
>USE Pubs
>GO
>EXEC sp_grantdbaccess 'DM001\testesql', 'testesql'
>GO
>EXEC sp_addrolemember 'db_owner', 'testesql'
>GO
>sp_helpuser
>
>THE PROBLEM:
>After this, I connected myself in one workstation with the new user of
>domain (DM001\testesql)and try a connection via osql utility using the
>command line below. Well, in 1 server the connection was made successfully
>and got the waited result, but in the other server I received the error:
>Login failed for user '(null)'. Reason: Not associated with a trusted SQL
>Server connection.
>Comand line for SQLServer1 ==> successfully
>C:\osql - SSQLServer1 - and - Q"select TOP 1 au_lname, au_fname from
>pubs..authors".
>--Result:
>au_lname au_fname
>--- --
>Bennet Abraham
>(1 row(s) affected)
>Comand line for SQLServer2 ==> failed
>C:\osql - SSQLServer2 - and - Q"select TOP 1 au_lname, au_fname from
>pubs..authors".
>Login failed for user '(null)'. Reason: Not associated with a trusted SQL
>Server connection.
>Please, somebody has idea of that can be happening?
>Thx
>Nilton Pinheiro|||Hi Nilton,
I am having similar issue, can you share what steps you followed to resolve
this issue.
--Manoj
"Nilton Pinheiro via droptable.com" wrote:
> Hi... I solve this problem change permission in Local Policy
> thx
> --
> Message posted via http://www.droptable.com
>
Labels:
connectivity,
database,
environmentserver,
expert,
identical,
intriguing,
microsoft,
mysql,
oracle,
server,
servers,
somebody,
sql,
windows
Subscribe to:
Posts (Atom)