Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
mdhingra01
Posting Yak Master
179 Posts |
Posted - 2007-03-26 : 11:22:07
|
| When I run a sp, I recieve an message from SQL server that my set ANSI_NULLS and ARITHABORT values are not correct.I stepped though the sp and ran parts of it individually in Query analyzer and it all ran sucessfully. Just wondering where the problem is. Why does it run sucessfully outside the sp, but fails in the sp.When I add the ANSI_NULL tot he sp, I lose the code in my sp that follows the SET ANSI_NULL statement. Its weird.Has anyone experienced this before.Thanks |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-03-26 : 11:35:18
|
| Can you post your SP here?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
mdhingra01
Posting Yak Master
179 Posts |
Posted - 2007-03-26 : 13:43:26
|
| The following is the spALTER PROCEDURE [DBO].[MIS_PROOF_REPORTS] AS-- INSERT INTO #NOTTOPROOF FROM RAW_PROOF_OT_TO_PROOF_VWSelectVERSION,filekey,Source_Sys_CD,unit_coll,regimental,tel,descript,TOTAL,daterecvd,Q1a,Q2a,Q3a,Q4a,Q5a,Q6a,Q7a,Q8a,Q9a,' ' as Q10,Q10a,Q11a,Q12a,Q13a,Q14a,Q15a,Q16a,Q17a,Q18ainto #Nottoprooffrom RAWPROOF_NOT_TO_PROOF_VW--UPDATE RAWPROOF = RAWPROOF_NOT_TO_PROOF_VW IF FILES EXIST IN RAWPROOF_NOT_TO_PROOF_VW update ASetA.VERSION=B.VERSION,A.UNIT_COLL=B.UNIT_COLL,A.regimental=B.regimental,A.tel=B.tel,A.descript=B.descript,A.TOTAL=B.TOTAL,A.daterecvd=B.daterecvd,A.Q1a=B.Q1a,A.Q2a=B.Q2a,A.Q3a=B.Q3a,A.Q4a=B.Q4a,A.Q5a=B.Q5a,A.Q6a=B.Q6a,A.Q7a=B.Q7a,A.Q8a=B.Q8a,A.Q9a=B.Q9a,A.Q10=B.Q10,A.Q10a=B.Q10a,A.Q11a=B.Q11a,A.Q12a=B.Q12a,A.Q13a=B.Q13a,A.Q14a=B.Q14a,A.Q15a=B.Q15a,A.Q16a=B.Q16a,A.Q17a=B.Q17a,A.Q18a=B.Q18aFROM #Nottoproof B JOIN RAWPROOF A ON A.FILEKEY=B.FILEKEY AND A.SOURCE_SYS_CD=B.SOURCE_SYS_CDWHERE EXISTS(SELECT * FROM #Nottoproof c WHERE C.FILEKEY=a.FILEKEY AND C.SOURCE_SYS_CD=a.SOURCE_SYS_CD)--APPEND RAWPROOF_NOT_TO_PROOF TO RAWPROOF WHERE FILES THAT DON'T ALREADY EXISTS IN RAWPROOFINSERT RAWPROOF SELECT * FROM #Nottoproof A WHERE NOT EXISTS(SELECT * FROM RAWPROOF B WHERE A.FILEKEY=B.FILEKEY AND A.SOURCE_SYS_CD=B.SOURCE_SYS_CD)-- SUMMARY TABLE OF SCORES, HOURS AND FILE DETAILS FOR PROOFED FILESEXEC PRF_SUMMARY_SPDELETE FROM PRF_SUMMARYWHERE ALT_FILE_CLTR_CD LIKE 'N%'UPDATE ASET A.PROOF_TOTAL=B.SCOREFROM PIRS A JOIN PRF_SUMMARY B ON A.SOURCE_SYS_CD=B.SOURCE_SYS_CD AND A.UNIT_COLL=B.ALT_FILE_CLTR_CD AND A.FILE_YEAR=B.FILE_YEAR AND A.FILE_OCC_NUM=B.FILE_OCCURENCE_NOWHERE A.SOURCE_SYS_CD=B.SOURCE_SYS_CD AND A.UNIT_COLL=B.ALT_FILE_CLTR_CD AND A.FILE_YEAR=B.FILE_YEAR AND A.FILE_OCC_NUM=B.FILE_OCCURENCE_NO--REPORTSTRUNCATE TABLE PROOF80DINSERT PROOF80D SELECT * FROM PROOF80D_VWTRUNCATE TABLE PROOFFDINSERT PROOFFD SELECT * FROM PROOFFD_VWTRUNCATE TABLE PRUNITINSERT PRUNIT SELECT * FROM PRUNIT_VWTRUNCATE TABLE PROOFALLINSERT PROOFALL SELECT * FROM PROOFALL_VWTRUNCATE TABLE PROOFRPDINSERT PROOFRPD SELECT * FROM PROOFRPD_VWTRUNCATE TABLE PROOFPIDINSERT PROOFPID SELECT * FROM PROOFPID_VWTRUNCATE TABLE PROOFOFDINSERT PROOFOFD SELECT * FROM PROOFOFD_VWTRUNCATE TABLE PROOFHDINSERT PROOFHD SELECT * FROM PROOFHD_VW |
 |
|
|
mdhingra01
Posting Yak Master
179 Posts |
Posted - 2007-03-27 : 15:33:22
|
| The reason the code was blanking out after theset ansi_nulls OFF was I had GO after it.I put the SET ANSI_NULLS OFF and SET ARITHABORT ON at the begining of the sp and it seems to execute fine. There was an embeded sp so I needed to se those values there aswell. I did more research and found that I need these values set because there is a clustered index on one of the updating tables (PIRS) that included a computed field.Thanks |
 |
|
|
|
|
|
|
|