how we can store the value like that 001,003,023 etc in sql
server 2005

Answers were Sorted based on User's Feedback



how we can store the value like that 001,003,023 etc in sql server 2005..

Answer / gopi muluka

Using Character Datatypes
See this
CREATE TABLE NumAsVar (Num VARCHAR(50))
INSERT INTO NumAsVar VALUES ('001')
INSERT INTO NumAsVar VALUES ('002')
INSERT INTO NumAsVar VALUES ('021')

SELECT * FROM NumAsVar

Is This Answer Correct ?    12 Yes 5 No

how we can store the value like that 001,003,023 etc in sql server 2005..

Answer / mohammad saddam

CREATE TABLE NumAsVar (Num nvarchar(50))
INSERT INTO NumAsVar VALUES ('001')
INSERT INTO NumAsVar VALUES ('002')
INSERT INTO NumAsVar VALUES ('021')

Is This Answer Correct ?    5 Yes 1 No

how we can store the value like that 001,003,023 etc in sql server 2005..

Answer / laxman r

UPDATE [APPPARAM] SET [APPPARAM_VALUE] = Replicate('0', 3 -
Len(convert(varchar, (@DATABASE_IDENTITY_NO + 1)))) +
convert(varchar, (@DATABASE_IDENTITY_NO + 1)) FROM
[APPPARAM] a WHERE a.[APPPARAM_KEY] = @AppParamKey

Is This Answer Correct ?    3 Yes 2 No

how we can store the value like that 001,003,023 etc in sql server 2005..

Answer / sandeep modapathi

replicate('0',3-len(field_name))+field_name

Is This Answer Correct ?    0 Yes 1 No

how we can store the value like that 001,003,023 etc in sql server 2005..

Answer / achuthan

set @s= ''
select @s=@s+column +','
if Len(@s)>0
select @s = substring(@s,1,len(@s)-1)

Is This Answer Correct ?    0 Yes 6 No

how we can store the value like that 001,003,023 etc in sql server 2005..

Answer / nadeem

create table t(NUM int(22))
insert into t values(001)
insert into t values(002)
insert into t values(023)

Is This Answer Correct ?    1 Yes 9 No

how we can store the value like that 001,003,023 etc in sql server 2005..

Answer / sathish kondaveeti

create table value(num int(3))
insert into value values(001)
insert into value values(003)
insert into value values(023)

to see this table
select * from value

Is This Answer Correct ?    0 Yes 10 No

Post New Answer

More SQL Server Interview Questions

Which system table contains information on constraints on all the tables created?

2 Answers  


Explain how to maintain a fill factor in existing indexes?

0 Answers  


Differentiate between ms sql server reporting services vs crystal reports?

0 Answers  


if you encounter this kind of an error message, what you need to look into to solve this problem? : Sql server database administration

0 Answers  


What is the contrast amongst drop and truncate?

0 Answers  






What is database architecture? : SQL Server Architecture

0 Answers  


What is user-defined scalar function?

0 Answers  


What is referential integrity? What are the advantages of it?

4 Answers   Descon, Digital Domain,


Can Having clause be used without Group by clause?

6 Answers   CarrizalSoft Technologies, CSC, CTS,


What is a full text index?

0 Answers  


explain different types of jions with examples briefly?

2 Answers   Accenture, Excellence, Zensar,


What is normalization? Describe its different types.

0 Answers   Wipro,


Categories