SQL Server : Transpose rows to columns

One way to do it if tagID values are known upfront is to use conditional aggregation SELECT TimeSeconds, COALESCE(MAX(CASE WHEN TagID = ‘A1’ THEN Value END), ‘n/a’) A1, COALESCE(MAX(CASE WHEN TagID = ‘A2’ THEN Value END), ‘n/a’) A2, COALESCE(MAX(CASE WHEN TagID = ‘A3’ THEN Value END), ‘n/a’) A3, COALESCE(MAX(CASE WHEN TagID = ‘A4’ THEN Value … Read more

Column conflicts with the type of other columns in the unpivot list

It’s actually a collation issue. I can resolve it by changing these lines: CAST([type] collate database_default AS VARCHAR(255)) AS [type], CAST(type_desc collate database_default AS VARCHAR(255)) AS type_desc, CAST(create_date AS VARCHAR(255)) AS create_date, CAST(lock_escalation_desc collate database_default AS VARCHAR(255)) AS lock_escalation_desc The specific issue is that name is collated as Latin1_General_CI_AS, whereas the other 3 columns you … Read more

Update values in identity column

You are trying to perform an update, not inserting new rows. In order to do that, you will need to set identity_insert ON and copy the row you want to update to a new row with the new ID value, then delete the old row (assuming no FK is referencing it) Something along the lines … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)