Interviewer And Interviewee Guide

MS SQL Server Interview Question:

What Are Character String Data Types in MS SQL Server?

Submitted by: Administrator
Character string data types are used to store code page based character strings. SQL Server 2005 supports the following character string data types:

* CHAR - Code page based character strings with a fixed length of n bytes defined as CHAR(n). The maximum length is 8,000 bytes. CHAR has a synonym of CHARACTER.
* VARCHAR - Code page based character strings with a variable length of n bytes defined as VARCHAR(n). The maximum length is 8,000 bytes. VARCHAR has two synonyms of CHAR VARYING and CHARACTER VARYING. VARCHAR also has special form as VARCHAR(MAX), which can store up to 2^31-1 bytes.
* TEXT - Code page based character strings with a variable length up to 2^31-1 (2,147,483,647) bytes. TEXT is equivalent to VARCHAR(MAX).

Here are some good examples of character string values:

PRINT 'Hello! '; -- CHAR(10)
PRINT 'Hello!'; -- VARCHAR(10)
GO

Submitted by: Administrator

Read Online MS SQL Server Job Interview Questions And Answers
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.