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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Faster Query?

Author  Topic 

neutcomp
Posting Yak Master

111 Posts

Posted - 2003-09-02 : 03:30:41
Hello,


For x = 0 To Ubound(arr_datum, 2) Step 1
mySQL = "INSERT INTO tbl_beschikbaarheid(id_huis,jaar,week, status, active) VALUES ("& id_huizen &", "& arr_datum(0,x) &", "& arr_datum(1,x) &", 'aanvraag', 1)"
conn.Execute(mySQL)

mySQL = "SELECT @@IDENTITY FROM tbl_beschikbaarheid"
Set myRecSet = conn.Execute(mySQL)

mySQL = "INSERT INTO tbl_datum(id_boeking, id_beschikbaarheid) VALUES("& id_boeking &", "& myRecSet(0) &")"
conn.Execute(mySQL)
Next


Can this peace of code writen bether/faster?

Thanxx
Bjorn

SqlStar
Posting Yak Master

121 Posts

Posted - 2003-09-02 : 04:59:46
Hi,

why we do like this? Shall we do the same using stored procedure.If we use stored procedure, we can do instead of 3 back-end transaction, in single connection.Normally, compare to static sql when passing from frond-end application, stored procedure is faster.

This my suggestion...
Thanks

":-) IT Knowledge is power :-)"
Go to Top of Page

neutcomp
Posting Yak Master

111 Posts

Posted - 2003-09-02 : 05:20:12
Oke I newer worked with storeprocedures. I think this is because I always work with ASP and Access databases or PHP and MySQL.

Can you tell me if I can use storeprocedures and If so how?

Thanxx
Bjorn
Go to Top of Page
   

- Advertisement -