Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I am using SQL server 2008. I have a database (table name :Data) where one column's name is title and another one is date.
One of the entry in the first column is :
WOLVERINE LE COMBAT DE L'IMMORTEL
However here what is not working :
select date from Data where title = 'WOLVERINE LE COMBAT DE L''IMMORTEL'
select date , title from Data where title LIKE '%WOLVERINE LE COMBAT DE L''IMMORTEL%'
select date , title from Data where title LIKE '%WOLVERINE LE%'
Here what is working :
select date , title from Data where title LIKE '%WOLVERINE%'
select date , title from Data where title LIKE '%LE COMBAT DE L''IMMORTEL%'
select date , title from Data where title LIKE '%WOLVERINE LE%'
Yes, it works for 'WOLVERINE LE' when there is two spaces, even though I am pretty sure there is only one space in the database ( that is the case when I do a request).
Does someone know how come there is this error ?
EDIT : Well sorry it seems like there was really two spaces between them, when I tried to display it in my aspx page, the two spaces are automatically replaced with one space, that is why I could not see it.
If you have any confusion about the no. of spaces then just remove all the white space form both the sides
select date
from Data
where REPLACE(title,' ','') = REPLACE('WOLVERINE LE COMBAT DE L''IMMORTEL',' ','')
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I have a variable with a list on it and I need to use its value for my find option. I get an error when I set my id_user to id_u.
Here is the list
id_u = user_key[0]
This is my SELECT and WHERE
find = ("SELECT * FROM hashtags WHERE id_user=id_u")
You have to concatenate SELECT string with variable value.
Try like this:
id_u = user_key[0]
find = ("SELECT * FROM hashtags WHERE id_user=" + id_u)
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
608A
608 A
17113 R
16524 DC1
ASM-1780
234604A - Low L2 Cu
19658B-->
234605 - High L2 Cu
17015 Rev A 405734UD0A
43224A (W
23809 REVB
Is there an SQL server query that cleans the column above and removes the excess content on the right such that the data is converted to below:
608
608
17113
16524
ASM-1780
234604
19658
234605
17015
43224
23809
I have tried using STUFF, but it doesn't clean well.
You seem to want everything up to and including the first digit followed by a non-digit.
Well, this returns what you are asking for:
select str, left(str, patindex('%[0-9][^0-9]%', str + ' '))
Here is a db<>fiddle.
This question already has an answer here:
Error using DBUtils in first scenario [duplicate]
(1 answer)
Closed 1 year ago.
In karate, I am trying to read database query
* def AccountDetails = db.readRow('select * from ')
From this I am trying to read individual values from this query and set this to one value
* set oimattrDetails $.User Login = AccountDetails.UD_BLR_USR_USER_LOGIN
Here, UD_BLR_USR_USER_LOGIN - is of the attribute present in the particular database
I do not want to hard code this value at this point. Instead assign this to some reference value and call it
*def USER_LOGIN = UD_BLR_USR_USER_LOGIN
Now use USER_LOGIN
* set oimattrDetails $.User Login = AccountDetails.USER_LOGIN
Something like this..But this is not working
Can any one help me here with exact syntax to use
A lot depends on what is the type of object returned by this code:
db.readRow()
That code is not part of Karate and you should provide more details here on that part - otherwise no one can help you. If it is not written by you, talk to the person or team who has written it - there is no point in talking about database "attributes". Maybe a simple solution is to add some Java code to the db object (I am assuming this is a Java utility) - to solve for your specific use case.
In short, your question sounds to me that it has nothing to do with Karate.
I've been trying to extract any URL present within my 'Text' column in Big Query. The column contains a mixture of text and URLs dotted throughout (a cell might contain more than one URL) I'm trying to use this regexp:
SELECT
REGEXP_EXTRACT (Text, r'(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9%_:?\+.~#&//=]*')
FROM
Data.Text_Files
I currently get 'failed to parse regular expression' when I try to run the query. I've tried modifying it but to no avail.
The regexp works in an online builder but I'm just not sure how to incorporate it into Big Query.
Any help would be much appreciated - or at least pointers on how to incorporate regular expressions into Big Query!
Try below - it is for BigQuery Standard SQL (see Enabling Standard SQL and Migrating from legacy SQL)
WITH YourTable AS (
SELECT 1 AS id, 'What have you tried so far? Please edit your question to show a [Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve) of the code that you are having problems with, then we can try to help with the specific problem. You can also read [How to Ask](http://stackoverflow.com/help/how-to-ask). ' AS Text UNION ALL
SELECT 2 AS id, 'Important on SO, you can mark accepted answer by using the tick on the left of the posted answer, below the voting. see http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work#5235 for why it is important. There are more ... You can check about what to do when someone answers your question - http://stackoverflow.com/help/someone-answers.' AS Text UNION ALL
SELECT 3 AS id, 'If an answer has helped you solve your problem and you accept it you should also consider voting it up. See more at http://stackoverflow.com/help/someone-answers and Upvote section in http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work#5235' AS Text
)
SELECT
id,
REGEXP_EXTRACT_ALL(Text, r'(?i:(?:(?:(?:ftp|https?):\/\/)(?:www\.)?|www\.)(?:[\da-z-_\.]+)(?:[a-z\.]{2,7})(?:[\/\w\.-_\?\&]*)*\/?)') AS URL
FROM YourTable
This gives you output with id field, and repeated field with all respective URLs
If you need flattened result - you can use below variation
WITH YourTable AS (
SELECT 1 AS id, 'What have you tried so far? Please edit your question to show a [Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve) of the code that you are having problems with, then we can try to help with the specific problem. You can also read [How to Ask](http://stackoverflow.com/help/how-to-ask). ' AS Text UNION ALL
SELECT 2 AS id, 'Important on SO, you can mark accepted answer by using the tick on the left of the posted answer, below the voting. see http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work#5235 for why it is important. There are more ... You can check about what to do when someone answers your question - http://stackoverflow.com/help/someone-answers.' AS Text UNION ALL
SELECT 3 AS id, 'If an answer has helped you solve your problem and you accept it you should also consider voting it up. See more at http://stackoverflow.com/help/someone-answers and Upvote section in http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work#5235' AS Text
)
SELECT
id, URL
FROM (
SELECT id, REGEXP_EXTRACT_ALL(Text, r'(?i:(?:(?:(?:ftp|https?):\/\/)(?:www\.)?|www\.)(?:[\da-z-_\.]+)(?:[a-z\.]{2,7})(?:[\/\w\.-_\?\&]*)*\/?)') AS URL
FROM YourTable
), UNNEST(URL) as URL
Note: you can use here any regexp that you will be able to find on web - but what a must is - there is only one matching group is allowed! so all inner matching group should be escaped with ?: as you can see it in above examples. So the ONLY group that you expect to see in output should be left as is - w/o ?:
Your regex has an incomplete capturing group, and has 2 unescaped characters. I don't know which online regex builder you're using, but maybe you forgot to put your new regex into it?
The problems are as follows:
(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9%_:?\+.~#&//=]*
POINTERS TO PROBLEMS ON THIS LINE ---> ^1 ^^2
This is the start of a capturing group with no end. You probably want the ) right before the *.
All slashes need to be escaped. This should probably be \/ or maybe even \/\\.
Here is an example with both of my suggestions implemented: https://regex101.com/r/pt1hqS/1
Good luck fixing it!
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
Don't know what the error is but getting this error.
java.sql.SQLSyntaxErrorException: ORA-00936: missing expression
INSERT INTO DATABASE_APP_INFO
(
TECHNOLOGY, SERVICE_DOMAIN, SYSTEM, BUSINESS_PROCESS_SEQUENCE
, APPLICATION, BUSINESS_VALUE, INTERFACE_BATCH_JOB_SCRIPT
, TECHNOLOGY_OWNER, TECHNOLOGY_MANAGER, TECHNOLOGY_SME
, BUSINESS_OWNER, OWNER_NAME, PLATFORM, PREFIX
)
VALUES
.NET/C++, x Recognition, Metadata & Reporting System,
, Aardvark, User interface to listen to TV station audio recorded by Monitoring System, Interface
,Graves, Graves, K.Ray, T.Nuccio
, LANDMARK, ORACLE RAC, LDSMETA
Add brackets and quotes:
INSERT INTO DATABASE_APP_INFO
(
TECHNOLOGY, SERVICE_DOMAIN, SYSTEM, BUSINESS_PROCESS_SEQUENCE
, APPLICATION, BUSINESS_VALUE, INTERFACE_BATCH_JOB_SCRIPT
, TECHNOLOGY_OWNER, TECHNOLOGY_MANAGER, TECHNOLOGY_SME
, BUSINESS_OWNER, OWNER_NAME, PLATFORM, PREFIX
)
VALUES
(
'.NET/C++', 'x Recognition', 'Metadata & Reporting System', ''
, 'Aardvark', 'User interface to listen to TV station audio recorded by Monitoring System', 'Interface'
, 'Graves', 'Graves', 'K.Ray'
, 'T.Nuccio', 'LANDMARK', 'ORACLE RAC', 'LDSMETA'
)
Quotes around values are used to group the characters between the quotes into strings; so it's clear what characters belong to each field.
Brackets after VALUES are required to show the start and the end of the current row.