June 17, 2016 at 6:08 am
static number (12345) + ID number
June 17, 2016 at 6:20 am
franklinkeith (6/17/2016)
static number (12345) + ID number
This is somewhat terse – what is your question, exactly?
If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.
June 17, 2016 at 6:23 am
franklinkeith (6/17/2016)
static number (12345) + ID number
SELECT 12345[highlight="#ffff11"]00000[/highlight] + ID, so as long as your Id is less than 99999, it fits your criteria.
Lowell
June 17, 2016 at 6:31 am
Trying create a column with leading code 12345 along with id number. 12345 999999999.
June 17, 2016 at 6:33 am
what if my id is 9 digits? and the code is 5 digits? 12345 999999999
June 17, 2016 at 6:40 am
nilknarf (6/17/2016)
static number (12345) + ID number
What does the 12345 represent?
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 17, 2016 at 6:42 am
I'm trying to add the formula in column properties 12345 ' ', idnumber
I get this error saving
'IDCARD' table
- Unable to modify table.
Incorrect syntax near ' '.
any help is greatly appreciated just a beginner.. :-):-)
June 17, 2016 at 6:45 am
nilknarf (6/17/2016)
Trying create a column with leading code 12345 along with id number. 12345 999999999.
so, a string that happens to contain numbers then, since you included a space?
i would use an identity field, and a persisted calculated column.
CREATE TABLE MYTable (ID int identity(1,1) not null primary key, Sometext varchar(30))
ALTER TABLE MYTABLE ADD
CompanyID AS '12345 ' + RIGHT('000000000' + CONVERT(VARCHAR,ID),9) PERSISTED
Lowell
June 17, 2016 at 10:44 am
Or:
id bigint IDENTITY(12345000000000, 1) NOT NULL,
...
SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.
June 19, 2016 at 10:05 pm
'12345' + replace(STR(ID,9,0), ' ', '0')
_____________
Code for TallyGenerator
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply