• JKSQL (5/9/2014)


    I gotta stop using loops! I know the tally works better. Thanks for the reminder. Worked great.

    If possible why not break this into separate columns? Saves a lot of headaches when you have proper normalization. You are using a single column to hold 6 values. Then if you want to have the full version put together you could use a computed column.

    Something like this would be a lot easier to work with.

    create table AppVersion

    (

    Release smallint not null,

    Major smallint not null,

    Minor smallint not null,

    Build smallint not null,

    ServicePack smallint not null,

    Revision smallint not null,

    FullVersion as cast(Release as varchar) + '.'

    + cast(Major as varchar) + '.'

    + cast(Minor as varchar) + '.'

    + cast(Build as varchar) + '.'

    + cast(ServicePack as varchar) + '.'

    + cast(Revision as varchar)

    )

    insert AppVersion

    select 107, 1055, 0403, 1001, 110, 1011

    select *

    from AppVersion

    _______________________________________________________________

    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/