• GuruGPrasad (9/4/2012)


    Table Script

    CREATE TABLE [dbo].[currency](

    [currency_code] [varchar](3) NOT NULL,

    [country] [varchar](256) NOT NULL,

    [currency_name] [varchar](256) NULL,

    [active] [int] NULL,

    CONSTRAINT [PK_currency] PRIMARY KEY CLUSTERED

    (

    [currency_code] ASC

    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

    ) ON [PRIMARY]

    Insert Script

    INSERT INTO [dbo].[currency]

    ([currency_code]

    ,[country]

    ,[currency_name]

    ,[active])

    VALUES

    ('AED' ,'United Arab Emirates',NULL,0)

    INSERT INTO [dbo].[currency]

    ([currency_code]

    ,[country]

    ,[currency_name]

    ,[active])

    VALUES

    ('AFN' ,'AFN',NULL,0)

    INSERT INTO [dbo].[currency]

    ([currency_code]

    ,[country]

    ,[currency_name]

    ,[active])

    VALUES

    ('ALL' ,'ALL',NULL,0)

    INSERT INTO [dbo].[currency]

    ([currency_code]

    ,[country]

    ,[currency_name]

    ,[active])

    VALUES

    ('AMD' ,'Armenia, Drams',NULL,0)

    INSERT INTO [dbo].[currency]

    ([currency_code]

    ,[country]

    ,[currency_name]

    ,[active])

    VALUES

    ('ANG' ,'Netherlands Antilles, Guilders (also called Florins)',NULL,0)

    I need to concatenate country and currency_code with equal space

    My desired output is

    Combined string

    ------------------------------------------------------------

    United Arab Emirates, Dirhams AED

    Afghanistan, Afghanis AFN

    Albania, Leke ALL

    Armenia, Drams AMD

    Netherlands Antilles, Guilders (also called Florins) ANG

    Space between the two string should depends on max(len(country))

    Any one help me. Thanks in advance..

    Regards,

    Guru

    I'm sorry, but I am lost on what you are asking for here.