|
INTERVIEW QUESTIONS
DATABASE
MS SQL SERVER
DETAILS
Question: How To Concatenate Two Binary Strings Together?
Answer: SQL Server 2005 allows to concatenate two binary strings into a single string with the (+) operator. The following tutorial exercise shows you some binary string concatenation examples:
-- Concatenating two binary string literals SELECT 0x57656C636F6D6520746F20 + 0x46594963656E7465722E636F6D; GO 0x57656C636F6D6520746F2046594963656E7465722E636F6D
-- Watch out: This is not a binary string concatenation SELECT '0x57656C636F6D6520746F20' + '0x46594963656E7465722E636F6D'; GO 0x57656C636F6D6520746F200x46594963656E7465722E636F6D
-- Concatenating two binary strings SELECT CONVERT(VARBINARY(40),'Welcome to ') + CONVERT(VARBINARY(40),'GlobalGuideLine.com'); GO 0x57656C636F6D6520746F2046594963656E7465722E636F6D
-- Binary strings can not be concatenated with character strings SELECT 'Welcome to ' + 0x46594963656E7465722E636F6D; GO Msg 402, Level 16, State 1, Line 1 The data types varchar and varbinary are incompatible in the add operator.
|
|
|
Category |
MS SQL Server Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.2) By 8987 users |
Added on |
9/23/2014 |
Views |
68232 |
Rate it! |
|
|
Question:
How To Concatenate Two Binary Strings Together?
Answer:
SQL Server 2005 allows to concatenate two binary strings into a single string with the (+) operator. The following tutorial exercise shows you some binary string concatenation examples:
-- Concatenating two binary string literals SELECT 0x57656C636F6D6520746F20 + 0x46594963656E7465722E636F6D; GO 0x57656C636F6D6520746F2046594963656E7465722E636F6D
-- Watch out: This is not a binary string concatenation SELECT '0x57656C636F6D6520746F20' + '0x46594963656E7465722E636F6D'; GO 0x57656C636F6D6520746F200x46594963656E7465722E636F6D
-- Concatenating two binary strings SELECT CONVERT(VARBINARY(40),'Welcome to ') + CONVERT(VARBINARY(40),'GlobalGuideLine.com'); GO 0x57656C636F6D6520746F2046594963656E7465722E636F6D
-- Binary strings can not be concatenated with character strings SELECT 'Welcome to ' + 0x46594963656E7465722E636F6D; GO Msg 402, Level 16, State 1, Line 1 The data types varchar and varbinary are incompatible in the add operator. Source: CoolInterview.com
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
How To Locate and Take Substrings with CHARINDEX() and SUBSTRING() Functions?
|
View Answer
|
|
How To Insert New Line Characters into Strings?
|
View Answer
|
|
What Are the Character String Functions Supported by SQL Server 2005?
|
View Answer
|
|
How To Convert a Unicode Strings to Non-Unicode Strings?
|
View Answer
|
|
What Happens When Unicode Strings Concatenate with Non-Unicode Strings?
|
View Answer
|
|
How To Concatenate Two Character Strings Together?
|
View Answer
|
|
How To Generate Random Numbers with the RAND() Function in MS SQL Server?
|
View Answer
|
|
How To Round a Numeric Value To a Specific Precision?
|
View Answer
|
|
How To Convert Numeric Values to Integers in MS SQL Server?
|
View Answer
|
|
What Are the Mathematical Functions Supported by SQL Server 2005?
|
View Answer
|
|
What Happens When Converting Big Values to NUMERIC Data Types?
|
View Answer
|
|
What Happens When Converting Big Values to Integers?
|
View Answer
|
|
How To Convert Character Strings into Numeric Values?
|
View Answer
|
|
How To How To Convert Numeric Expression Data Types using the CONVERT() Function??
|
View Answer
|
|
How To Convert Numeric Expression Data Types using the CAST() Function?
|
View Answer
|
|
How To Convert Numeric Expression Data Types by Assignment Operations?
|
View Answer
|
|
How To Convert a Numeric Expression from One Data Type to Another?
|
View Answer
|
|
What Is an Expression in MS SQL Server?
|
View Answer
|
|
What Are the Underflow and Overflow Behaviors on FLOAT Literals?
|
View Answer
|
|
How REAL and FLOAT Literal Values Are Rounded?
|
View Answer
|