Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews Databases Programming Interviews:BtrieveClipperData ModelingData StructuresDatabase AdministrationDatabase Administrator (DBA)Database AnalystDatabase DeveloperDB DevelopmentEDI/Data Integration ExpertFirebirdHierarchicalIBM DB2InformixJava DatabaseMariaDBMicrosoft Access DeveloperMongoDBMS SQL ServerMySQL ProgrammingNetworkNoSQLObject RelationalPostgrePostgreSQLProgressRDBMSRelationalSQLSQL AdministratorSQL and PL/SQLSQL Notification ServicesSQL server 2008SSRSStored ProcedureSybaseTeradata
Copyright © 2018. All Rights Reserved
MS SQL Server Interview Question:
What Are the Differences between CHAR and VARCHAR in MS SQL Server?
Submitted by: AdministratorCHAR and VARCHAR are both used to store code page based character strings. But they have the following main differences:
* CHAR(n) stores character strings with a fixed length, n bytes, storage format.
* VARCHAR(n) stores character strings with a variable length, less than n bytes, storage format.
* If the input string of CHAR(n) has less than n bytes, it will be padded with space characters to become n bytes.
* If the input string of VARCHAR(n) has less than n bytes, it will not be padded with any characters.
* If the input string of CHAR(n) has more than n bytes, it will be truncated to n bytes.
* If the input string of VARCHAR(n) has more than n bytes, it will also be truncated to n bytes.
Submitted by: Administrator
* CHAR(n) stores character strings with a fixed length, n bytes, storage format.
* VARCHAR(n) stores character strings with a variable length, less than n bytes, storage format.
* If the input string of CHAR(n) has less than n bytes, it will be padded with space characters to become n bytes.
* If the input string of VARCHAR(n) has less than n bytes, it will not be padded with any characters.
* If the input string of CHAR(n) has more than n bytes, it will be truncated to n bytes.
* If the input string of VARCHAR(n) has more than n bytes, it will also be truncated to n bytes.
Submitted by: Administrator
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.