• denis.gendera (3/20/2013)


    All,

    I'm having strange issue trying to do the following which I thought was just going to be straight forward

    select top 5 machine.name, machine.model, machine.scantime

    'INSERT INTO [SMS_000].[dbo].[BMCMachines] ([ComputerName],[MachineModel],[stime]) VALUES (' + '''' + machine.name + ''',' + '''' + machine.model + ''',' + convert(datetime,machine.scantime,112) + ''')' from machine

    when I run the query comes back with following error

    Msg 241, Level 16, State 1, Line 1

    Conversion failed when converting date and/or time from character string.

    I can confirm that machine.scantime is "DateTime" column.

    Take a closer look at your Convert function and be sure that is what you are actually wanting to do.