June 19, 2015 at 9:02 am
Hello everyone
I need to compare to string in sql
requirement is
Select Reson_id from reason_data where reason='ryete / werewr ddsad '
is there any way without string function? bcz string function take more exaction time
June 19, 2015 at 9:14 am
meerack11 (6/19/2015)
Hello everyoneI need to compare to string in sql
requirement is
Select Reson_id from reason_data where reason='ryete / werewr ddsad '
is there any way without string function? bcz string function take more exaction time
Please explain what you mean by: "without string function".
For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]
June 19, 2015 at 9:14 am
I'm afraid you will need to be more specific. What 'String' are you trying to compare? Do you need help modifying your statement?
Select Reson_id from reason_data where reason='ryete / werewr ddsad '
Please provide a sample of data and what your expected results are.
Here is a good place to start: http://www.sqlservercentral.com/articles/Best+Practices/61537/
Thanks,
June 19, 2015 at 10:04 am
I mean SUBSTRING or other function
June 19, 2015 at 10:05 am
I am comparing string like 'djfs / esfsdf '
June 19, 2015 at 10:07 am
the string contain space and slash
June 19, 2015 at 11:01 am
What's the problem with space and slash? Those are just characters as any other in a string.
is there any way without string function? bcz string function take more exaction time
Do some microseconds really matter? That's the extra execution time to apply a function on a string.
June 19, 2015 at 11:08 am
AI had use = and like but it doent work
June 19, 2015 at 11:13 am
meerack11 (6/19/2015)
AI had use = and like but it doent work
Doesn't work? What do you mean? An error? Incorrect results?
What was the input? What does the data look like? What are the expected results? Share more information, share details, help us help you.
June 19, 2015 at 11:14 am
Here is the problem, we can't see what you see. We don't have access to your systems, we don't know what the data looks like, and we don't fully understand what it is you are trying to accomplish. You need to help us help you. Step 1, read the first article you will find linked in my signature block. Step 2, follow the steps in that article to post the information we need to help you.
June 19, 2015 at 11:37 am
select * from GLCode_DATA where GLCode ='602-434345_Planning - Expedited Air'
in table GL code='602-434345_Planning - Expedited Air' is variable but result show me nothing
June 19, 2015 at 11:39 am
select * from GL_CODE_DATA where Gl_code='602-434345_Planning - Expedited Air'
I have Gl_code='602-434345_Planning - Expedited Air' in table but result show me nothing
June 19, 2015 at 11:41 am
select * from Gl_code_data where Gl_code='602-43335_Planning - Expedited Air'
I have Gl_code='602-434345_Planning - Expedited Air' this record in table but result show me nothing
June 19, 2015 at 11:47 am
You might not have that value in your table or maybe you're not really comparing to that value
The following code might give you ideas to look for.
CREATE TABLE #GLCode_DATA
(
GLCode varchar(100)
)
INSERT INTO #GLCode_DATA
VALUES('602-434345_Planning - Expedited Air'), ('602-434345_Planning' + CHAR(10) + '- Expedited Air')
select * from #GLCode_DATA --2 rows
select * from #GLCode_DATA
where GLCode ='602-434345_Planning - Expedited Air' --1 row
DECLARE @GlCode varchar --Incorrect Declaration
SET @GlCode = '602-434345_Planning - Expedited Air'
select * from #GLCode_DATA where GLCode = @GlCode --0 rows
SELECT @GlCode --The string is trunctated
GO
DECLARE @GlCode varchar(100)
SET @GlCode = '602-434345_Planning - Expedited Air'
select * from #GLCode_DATA where GLCode = @GlCode --1 row
GO
DROP TABLE #GLCode_DATA
June 19, 2015 at 11:48 am
meerack11 (6/19/2015)
select * from Gl_code_data where Gl_code='602-43335_Planning - Expedited Air'I have Gl_code='602-434345_Planning - Expedited Air' this record in table but result show me nothing
This one should not show you anything because the 2 strings are different.
For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]
Viewing 15 posts - 1 through 15 (of 26 total)
You must be logged in to reply to this topic. Login to reply