question

yogeesha avatar image
yogeesha asked

how to update table value from another table have condition

update Attendence set Att_UpdateBit='0' where fk_Att_EmpCode In (select pk_Emp_Code from EmployeeMaster where ((@ATReprs_Location='All') or (fk_Emp_LocCode=@ATReprs_Location)) and ((@ATReprs_Catagory='All')or (fk_Emp_CatCode=@ATReprs_Catagory)) and ((@ATReprs_Department='All') or (fk_Emp_DepCode=@ATReprs_Department)))and Att_Date>=@ATreprs_Fromdate and Att_Date<=@ATreprs_Todate i am updating one table column from comparing other table condition with condition .Its Working fast only 50 employee ,,but if i update using "excel upload sheet"It will take so much time after it show "sql query time out " please can any one help me
sql2008
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

vivekyadav0212 avatar image
vivekyadav0212 answered
Please let us know how you are updating the table using excel(your VBA code), your connection settings and what is connection timeout there in VBA code ?
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

yogeesha avatar image yogeesha commented ·
Sir Actually ,I Am select Single employee And there Location from my code(c#)using dropdownlist ,,its working fast.but if i select employee "ALL" and Location "All" Deparment="All" it take time i dont know why? because of query problem or what? sorry I am Not Update Using Excel nw
0 Likes 0 ·
Fatherjack avatar image
Fatherjack answered
Are you using data imported into SQL from Excel or actually linking to an Excel source? If it is the latter then try importing it and if possible setting up some constraints on the data so that SQL Server can reference the two tables efficiently and you should see better performance.
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Manuelrdgz avatar image Manuelrdgz commented ·
If you are querying excel directly, I second FatherJack's suggestion. Import the excel info into a table and then just reference off of that.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.