• sasansamani (11/28/2012)


    Let me explain what exactly we are trying to do.

    Waste Hauler Unique Number Example: 00000-V/C 0000- AT- YR

    Requirements:

    Hauler # = 00000 (permanent)- there may be 1000 hauler companies

    Asset = V / C (vehicle or container + permanent #)

    Material/Classification = AT (landfill / temporary)- this may be different

    (Material: A- Landfill B-Recycling C-Compost)(Classification: T- Temporary P- Permanent)

    YR = Year (2013)

    So the best way to implement this is to use the Identity Property? Is that correct?

    I just need to know a logical way to implement this.

    Not sure exactly what you are trying to do from this. Are you wanting a single column to have all this information?

    If I were going to generate a table to hold this data it would look something like this.

    create table #Haulers

    (

    HaulerID int identity primary key,

    Asset char(1),

    Classification char(2),

    Material char(1),

    DateCreated datetime not null default getdate()

    )

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/