• The problem with creating a temp table gives the following possible errors

    --There is already an object named '#temp' in the database.

    Second I need business logic in the like '' for fields, a select into will give this error for this kind of values

    --An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as "" or [] are not allowed. Change the alias to a valid name.

    Ok so I replaced declare @tSalesLine table with create table #tSalesLine

    The runtime went down, performance not that much.