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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Lag in database possible?

Author  Topic 

elehoon
Starting Member

1 Post

Posted - 2010-11-24 : 01:54:37
Currently I have an array in php and an array obtained from my sql table. I would like to compare this two array, and make the SQL table match the array given in my php file. (its an array of objects with 9 variables)

Right now, the only way I can think of is firstly, check if the rows match, if no, what should I do? And if yes, then I have to check variable by variable. I'm thinking of a simple way where I delete the entire SQL table and populate according to the array in php one by one.

However, my array might get big, lets say 100 objects. Would it cause the database to crash as I have to delete 100 objects and insert 100 objects simultaneously. Is there a more effcient way?

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2010-11-24 : 03:40:31
What is an object?
An array sounds like a table and id 100 objects = 100 entries or 100 rows by 9 columns then that's very small.
Consider populating a staging table and comparing on te database.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-11-24 : 09:18:44
deleting or inserting 100 objects simultaneously is not a problem in db. but how do you want the insertion to happen? in same format in array as rows in table?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -