Showing posts with label final. Show all posts
Showing posts with label final. Show all posts

Tuesday, March 27, 2012

Considering blank spaces

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.

Friday, February 24, 2012

Connection string for the Ms-SQl Server using ASP.net

Hello,

I am doing the web based project for the final year of my couse
in Information Technology using Asp.net and ms-sql server.But to start
with that I need to connect my web pages to the database.
So Can anyone tell me how to connect my page web to the ms-sql
server using Asp.net(Connection String)?.It will be better if someone
give me the code for the connection string along with the explaination
so that I don't have problem understanding it.

Any kind of help will be appreciated.

Thank You.

Suchen Chodankar.Hi
Check out

http://msdn.microsoft.com/library/d.../SecNetHT03.asp
http://msdn.microsoft.com/library/d.../SecNetch12.asp
http://msdn.microsoft.com/library/d...ml/secmod83.asp
http://www.connectionstrings.com/

John

"Suchen Chodankar" <suchen.chodankar@.gmail.com> wrote in message
news:295fd3c8.0503112318.57e54ca3@.posting.google.c om...
> Hello,
> I am doing the web based project for the final year of my couse
> in Information Technology using Asp.net and ms-sql server.But to start
> with that I need to connect my web pages to the database.
> So Can anyone tell me how to connect my page web to the ms-sql
> server using Asp.net(Connection String)?.It will be better if someone
> give me the code for the connection string along with the explaination
> so that I don't have problem understanding it.
> Any kind of help will be appreciated.
> Thank You.
> Suchen Chodankar.