Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am trying to execute coalesce as nvl in oracle.
SELECT COALESCE('SYSTEM ADMIN',10)
ideally it should return "SYSTEM ADMIN" AS OUTPUT.
SELECT COALESCE(NULL,10)
And this should return 10.
but this syntax is returning....
SELECT COALESCE('SYSTEM ADMIN',10)
Conversion failed when converting the varchar value 'SYSTEM ADMIN' to data type int.
plz help what's wrong here
You should also return a string alternative, (must have the same data type)
SELECT COALESCE('SYSTEM ADMIN', '10') FROM ....
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 months ago.
Improve this question
How can I find data that dont end with letter 'g' without using NOT LIKE function, please help
select * from table where right(column, 1) != 'g'
Since you asked how to do it using "not like," I'll answer that. The function version provided by #Zoories would be more efficient.
This works at w3schools.com
SELECT * FROM Customers where CustomerName not like '%g';
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Can someone give me some example using Choose Function in SQL Server?
Have you ever used this function before? Is it useful for something?
The syntax would be -
CHOOSE ( index, val_1, val_2 [, val_n ] )
Example -
SELECT CHOOSE ( 3, 'Manager', 'Director', 'Developer', 'Tester' ) AS Result;
More Info : https://learn.microsoft.com/en-us/sql/t-sql/functions/logical-functions-choose-transact-sql
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
Team,
I need a sql query or function which will create the mirror image of string.
Thanks
Rajeev
If "mirror" is reversed text use:
SELECT REVERSE('my_text') FROM dual;
EDIT:
SqlFiddleDemo
SELECT t
,REVERSE(t) AS Mirror1
,TRANSLATE(t, 'abcdefghijklmnopqrstuvwxyz',N'ɐqɔpǝɟbɥıظʞןɯuodbɹsʇnʌʍxʎz') AS Mirror2
,TRANSLATE(REVERSE(t), 'abcdefghijklmnopqrstuvwxyz',N'ɐqɔpǝɟbɥıظʞןɯuodbɹsʇnʌʍxʎz') AS Mirror3
FROM tab;
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
How do I know which datatype will accept Null value and which datatype will not accept null value in SQL.
which datatype will accept null value??
NULL means ABSENCE of data. Means any datatype without value can have NULL value.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
How to convert MM/DD/YY (for example: 12/23/14) to YYYY-MM-DD (for example: 2014-12-23) in MS SQL Server 2012?
CONVERT(VARCHAR(10),GETDATE(),126)
If you're looking to load the data into a column that is the Date datatype, then you can cast a string as a date:
CAST('12/23/14' AS DATE)