Conversion failed when converting the varchar/nvarchar value to data type int

SELECT CONVERT([int],11.25)-CONVERT([int],’10.25′) How to avoid error and return 1 as result. >Solution : Rather than using the implicit behaviour of the CONVERT function, why not use the correct function, e.g. ROUND SELECT ROUND(11.25, 0)-ROUND(CONVERT(DECIMAL(9,2),’10.25′), 0)

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

I have the following SQL query: SELECT D.name, X.displayName, x.diff, X.tacticalParameter_id into kk_aux FROM ( select displayName, tacticalParameter_id, b.value,datediff(DAY,convert(date,b.value,101),convert(date,getdate(),101)) as diff from EDA_TENANT1.EDA_T_P_A A, eda_tenant1.EDA_T_P_A_V b where b.attribute_id = A.ID and displayName like ‘Fecha %’ and value <> ”) X, EDA_TENANT1.EDA_T_P C, EDA_TENANT1.EDA_TACT_P_G D WHERE X.tacticalParameter_id = C.id AND C.tacticalParameterGroup_id = D.id and D.NAME in… Read More Conversion failed when converting date and/or time from character string. SQL query

I'm having a weird issue with IDENTITY_INSERT & am at a loss. Can anyone see what I'm missing?

I’m getting an error when trying to execute the following statements complaining that IDENTITY_INSERT must be on in order for the insert to occur, but I am turning it on. SET IDENTITY_INSERT Thompson_GDM.dbo.employees ON GO INSERT INTO Thompson_GDM.dbo.employees SELECT [EmployeeId], [AssignmentId], [more columns…] FROM TMLAVSQLBIS.ThompsonMachinery.dbo.Employees; GO SET IDENTITY_INSERT Thompson_GDM.dbo.employees OFF go The error message is… Read More I'm having a weird issue with IDENTITY_INSERT & am at a loss. Can anyone see what I'm missing?

Insert a column from one table another as a row based on months and years defined in each column

I have a table and I need to insert the data from that table into another blank table in a certain way. Year LoanType ProcessDate Month Balance RowNum TypeRow PercentChange LastCol 2022 0 20220430 04 500 1 1 -1.22 450 2022 0 20220331 03 450 2 2 1.01 200 2022 0 20220228 02 200 3… Read More Insert a column from one table another as a row based on months and years defined in each column

SQL join manager from same table onto a row with their employees

To start, here’s a dummy table I’ve made to show the data I’m working with: employee title division email Boss Person boss o bp@email John Smith supervisor a jos@email Jane Smith supervisor b jas@email Leo Messi employee a lm@email Amanda Kessel employee a ak@email Derek Jeter employee b dj@email I want to end up with… Read More SQL join manager from same table onto a row with their employees