|
INTERVIEW QUESTIONS
DATABASE
MS SQL SERVER
DETAILS
Question: How To Concatenate Two Character Strings Together?
Answer: Concatenating two character strings together is most commonly used string operation. SQL Server 2005 allows to concatenate two character strings into a single string with the (+) operator. The following tutorial exercise shows you some string concatenation examples:
DECLARE @site VARCHAR(40); SET @site = 'GlobalGuideLine.com'; SELECT 'Welcome to '+@site; SELECT 'Current date and time is ' +CONVERT(VARCHAR(20), GETDATE()); GO Welcome to GlobalGuideLine.com Current date and time is May 19 2007 5:18PM
DECLARE @start INT, @end INT, @total INT; SET @start = 21; SET @end = 30; SET @total = 728; SELECT 'Search result ' + CONVERT(VARCHAR(20),@start) + ' - ' + CONVERT(VARCHAR(20),@end) + ' of ' + CONVERT(VARCHAR(20),@total); GO Search result 21 - 30 of 728
|
|
|
Category |
MS SQL Server Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.2) By 9243 users |
Added on |
9/23/2014 |
Views |
65937 |
Rate it! |
|
|
Question:
How To Concatenate Two Character Strings Together?
Answer:
Concatenating two character strings together is most commonly used string operation. SQL Server 2005 allows to concatenate two character strings into a single string with the (+) operator. The following tutorial exercise shows you some string concatenation examples:
DECLARE @site VARCHAR(40); SET @site = 'GlobalGuideLine.com'; SELECT 'Welcome to '+@site; SELECT 'Current date and time is ' +CONVERT(VARCHAR(20), GETDATE()); GO Welcome to GlobalGuideLine.com Current date and time is May 19 2007 5:18PM
DECLARE @start INT, @end INT, @total INT; SET @start = 21; SET @end = 30; SET @total = 728; SELECT 'Search result ' + CONVERT(VARCHAR(20),@start) + ' - ' + CONVERT(VARCHAR(20),@end) + ' of ' + CONVERT(VARCHAR(20),@total); GO Search result 21 - 30 of 728 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 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
|
|
How Extra Digits Are Handled with NUMERIC Data Type Literals?
|
View Answer
|
|
What Happens If an Integer Is Too Big for INT Date Type?
|
View Answer
|
|
What Are Out-of-Range Errors with Date and Time Literals?
|
View Answer
|
|
What Happens If Time-Only Values Are Provided as Date and Time Literals?
|
View Answer
|
|
What Happens If Date-Only Values Are Provided as Date and Time Literals?
|
View Answer
|
|
Why I Can Not Enter 0.001 Second in Date and Time Literals in MS SQL Server?
|
View Answer
|