how we can store the value like that 001,003,023 etc in sql
server 2005
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
Answer / sandeep modapathi
replicate('0',3-len(field_name))+field_name
| Is This Answer Correct ? | 0 Yes | 1 No |
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 |
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 |
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 |
What is lock escalation?
What is the difference between createstatement and preparedstatement?
What is table join?
What is the difference between windows authentication and sql server authentication
what are the different types of replication you can set up in sql server? : Sql server database administration
What is user-defined function? Explain its types i.e. Scalar and inline table value user-defined function?
explain the storage models of olap? : Sql server database administration
4 Please write a querry to find repeated numbers in the following table. Table Name: Table1 Field1 10 15 20 15 10
If you are given access to a SQL Server, how do you find if the SQL Instance is a named instance or a default instance?
What is sql server english query?
Can we create nonclustered index in a table without creating a clustered index
What is a non-clustered index?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)