Issue with a column name, I think

  • Someone made typos when creating our tables.
    Manufaturing is the name of the column in the tables. that is fine.
    but there is a Period in the [INVOICE DATE.] column.

     I have pulled that field before, and it has not been an issue.
    Today, i need to concat that field as such....

    .Concat( [Customer Product Id],'-',M.[Manufaturing Site Id],'-',Datepart(yyyy, [Invoice Date.]),'-','Y') as PSY

    it fails for Msg 258, Level 15, State 1, Line 54   Cannot call methods on numeric.
    Is the period causing this problem?
    Can i work around it?  If i have the column renamed, it might cause other reports to fail.

    Thoughts?

    thanks

  • Not sure what the leading decimal is before concat, but the column name should have any effect, even though those columns names are not good.

    create table #t(
    [Customer Product Id] varchar(10),
    [Manufaturing Site Id] varchar(10),
    [Invoice Date.] date)

    insert into #t values
    ('1','1','1/1/2019'),
    ('2','2','1/1/2019'),
    ('3','3','1/1/2019'),
    ('4','4','1/1/2019')
    select Concat( [Customer Product Id],'-',[Manufaturing Site Id],'-',Datepart(yyyy, [Invoice Date.]),'-','Y') as PSY
    from #t

    For better, quicker answers, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • wow.  Two hours and i didnt notice the period instead of a comma

    Wow . . . i owe you 3 beers!

    thanks so much.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply