[Solved] SQL – Temptable Identity Column not working [duplicate]

You have defined three columns in the INSERT INTO statement – but the SELECT only provides two. Change your code to so you’re not inserting values into your IDENTITY column: — NOT NEEDED! SET IDENTITY_INSERT #TEMPTABLE ON; INSERT INTO #TEMPTABLE(CARDNO, OFFICEPUNCH) SELECT CARDNO, OFFICEPUNCH FROM [Tempdata] — NOT NEEDED! SET IDENTITY_INSERT #TEMPTABLE OFF; 1 solved … Read more

[Solved] SQL Field Length

You need just this: SELECT @list = seg_tag + ’01’ + RIGHT(‘0′ + CAST(LEN(ID_Type) AS varchar), 2) + ID_Type + ’02’ + RIGHT(‘0′ + CAST(LEN(IDNumber) AS varchar), 2) + IDNumber FROM #TEMP_TABLE_ID Or SELECT @list = seg_tag + ’01’ + CASE WHEN LEN(ID_Type) < 10 THEN ‘0’ ELSE ” END + + CAST(LEN(ID_Type) AS varchar) … Read more

[Solved] IsNull with Equal ¿What does this means?

It means that if costo_gerencias.plde_codigo is null, it will return 0 or whatever the second argument is to the ISNULL function. In this case, the WHERE clause is basically saying “where vol.espe_codigo is equal to matriz.espe_codigo and costo_gerencias.plde_codigo is null or equal to zero.” 1 solved IsNull with Equal ¿What does this means?

[Solved] NULL Conditons in SQL Server [duplicate]

You need to pass the value of the Combobox in @Status: Here you need to set conditions like this: DECLARE @Status varchar(15) –set the Status SELECT * FROM tbl_Location WHERE (@Status=”All” OR (@Status=”Nulls” AND YEAR IS NULL) OR (@Status=”Not Nulls” AND YEAR IS NOT NULL) ) 3 solved NULL Conditons in SQL Server [duplicate]

[Solved] How to filter twice using subquery? [closed]

I think you just need this. There is no need for the subquery. SELECT DISTINCT T0.project_number_ext as ProjectNumber ,T0.status_desc as SDesc ,T0.Project_name as PName From trimergo.rpt_getProjectPOC T0 WHERE T0.sproject_number IS NULL AND ( T1.SDesc LIKE ’10 – In Proposal%’ OR T1.SDesc like ’90-Lost Opportunity%’ ) 3 solved How to filter twice using subquery? [closed]

[Solved] SQL Server Loop and Cursors [closed]

SET NOCOUNT ON will prevent a message being returned saying how many rows were updated. In some situations in code this is necessary because the message is interpreted as an additional resultset. There is also some additional overhead with this message. CURSORS are used to perform operations in a procedural fashion instead of the usual … Read more

[Solved] Entity framework long living data context vs short living data context [closed]

Open and close as quickly as possible. Let ADO.Net connection pooling take care of minimizing overhead of actually connecting to the database over and over. As long as you use the same connection string, closing a connection does not actually close it. It just releases it back to ADO.Net connection pool. The longer you keep … Read more