The definition of object has changed
SQL 2008 R2I have a sproc that runs daily. Every week, at least once, I get the error that "The definition of object 'xxx' has changed since it was compiled." The sproc hasn’t changed in months. The...
View Articleupdate columns in Table A based on columns in Table B for more than 500K rows
Guys,I need to update 9 columns in table A based on value from table B for for more than 500K rows.So what is best way to achieve this. I am thinking of writing a Procedure with cursor to update the...
View ArticleMerging 2 records and summing up to have just 1 record
All,I have a situation where I need to do a union of 2 data sets. The columns will be the same in both the sets but the data will come from different source tables. So, for example, these are the...
View ArticlePrimary key violation when inserting records with insert_identity and...
My problem is this: I have data in a couple of temporary tables including relations (one table referencing records from another table by using temporary keys). Next, I would like to insert the data...
View ArticleCartision Product
Hi i have come across a query with the following sanerio. Table Name : TeamsTeam_ID, Team_Name-------------------------------1, India2,Pakistan3,Australia4,EnglandI would like to write a query to fetch...
View Articlehow to export data with column headers in sql server 2008 with bcp command?
Hi all,I want know "how to export data with column headers in sql server 2008 with bcp command", I know how to import data with import and export wizard. when i am trying to import data with bcp...
View Articlesql query for considering the difference in capitalization
Hi All,I have a table consisting a list of students, which has two fields , serialno and name.I need a list of all records in this table where the SerialNo field is the same but the name are not the...
View ArticleRollback only part of a transaction
I am using a cursor to loop through a dataset, and for each record in it I want to do an insert or update on a target table. (I run a stored procedure on each record).If there's an error (e.g., foreign...
View Articlecan a stored proc be called as and when base table changes , except trigger
Hi! I have a stored proc which transforms some data and fills some tables, so that reporting can be shown directallyfrom those tables( To speed up the reporting).I want to call this stored proc from...
View ArticleDate difference in Days,hours minutes and seconds.
Hi All,I have two date Suppose one is getdate() and other one is gatedate() +1 .I have to show the difference, currently I used a datediff in the stored proc which just shows the difference of the days...
View Articlemutiple CSV columns to mutiple rows
Hi,I have following dataId Col1 Col21 a|b|C|d y|||2 e|f|g N|||Output required:Id Posid Col1 col21 1 a y2 2 b3 3 c4 4 d5 1 e N6...
View ArticleDML Scripts standards on PROD day
I have 4000 lines of DML statements. Right now, each chunk of dml statement have comments along with FR. On PROD day if some error comes in middle of DML statement, some times it is becoming a...
View Articletwo execution plan for the same SQL syntax
Hello ,I have one SELECT syntax with different execution plan , one complete in 3 sec and other complete in 10 minSQL 2000 SP 4 ENT. edition, appreciate your recommendation
View Articlesql query to bind data from grid and print total count and amount total when...
SELECT SLHD.VOUCH_CODE,SLHD.VOUCH_DATE,SLHD.VOUCH_NUM,SUM(SLTXN.CALC_NET_AMT) AS AMT,ACT.ACT_NAME,SUM(SLTXN.TOT_QTY) AS QTY FROM SL_HEAD20132014 AS SLHD,ACCOUNTS AS ACT,SL_TXN20132014 AS SLTXN WHERE...
View ArticleSubstring of data
I have a table with a column that has a code with values like 296.0 and another column with the description of this code. If there is no description for the code 296, I want to update the description...
View ArticleCursor and Update rows based on value/date
SQL Server 2012Microsoft SQL Server Management Studio11.0.3128.0 Microsoft Analysis Services Client Tools11.0.3128.0 Microsoft Data Access Components (MDAC)6.1.7601.17514 Microsoft MSXML3.0 4.0 5.0 6.0...
View ArticleHow to create clustered index on a table which has all duplicate columns
Hi, I have a table which has good amount of data about 8 million records in it, but all the columns in it are with duplicate values. Now, i have created the non clustered indexes on some of the...
View ArticleUpdate statement failed
UPDATE provision SET telephone_number='55555555', email_address='test@test.com', fax_number='124544433' where telephone_number is not null or fax_number is not null or email_address is not null GO Msg...
View ArticleTrying to solve a re-occuring sql server crash by using WinDbg
Hi All, My SQL Server crashed a few times... and the error in the sql server error log viewer was the same - "...fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION..."Since sql server saved a minDump...
View ArticleMaximum DATEDIFF in MI (minutes)
I keep receiving an error when execute a query:The datediff function resulted in an overflow. The number of dateparts separating two date/time instances is too large. Try to use datediff with a less...
View Article