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 |
anthor
Starting Member
14 Posts |
Posted - 2012-01-21 : 14:14:03
|
i need to excute a sql query is storing in data row with T-SQL.let me explain more detail.i have saved all sql statement in a table name Tbl_Query,then T-SQL will excute all the Tbl_Query's Statement. below is my Tbl_Query Data Table.ID(INT)/Query(VARCHAR(MAX)/Executed(BIT) is the Table Column.ID Query Executed1 SELECT * FROM TBL_CAR False2 UPDATE TBL_CAR SET ID=2 WHERE ID=1 False3 INSERT INTO TBL_CAR (ID) VALUES (10) Falsehow to do that? |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
anthor
Starting Member
14 Posts |
Posted - 2012-01-21 : 14:40:16
|
Errmm,i m using this method is because i m afaid that if i got 400 records to INSERT/UPDATE or delete, but unfortunately the client pc is occur problem or shut down. maybe he only inserted 200 records only, so they need to restore back the data and re-insert again.but this method we can detect that if 400 records are inserted we only execute the all queue to make sure they wont miss it.p/s:afraid insert huge of record,but haven't inserted finish,the client pc is down.so the data only insert half.this is the problem1 more question.if i Passing 40000 records(maybe an array or Data Table) of integer IDs to select/update/delete records to stored procedure.after success passed.suddenly the client PC shut down or restarted.so the stored procedure or script still running on Server? |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2012-01-23 : 06:41:12
|
I have seen requests for this type of storage more than once. I fear that this is now being taught in "school". http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspxHow to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxFor ultra basic questions, follow these links.http://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp |
 |
|
LoztInSpace
Aged Yak Warrior
940 Posts |
Posted - 2012-01-24 : 01:24:11
|
Way to re-invent the stored procedure *and* transactions in one go!Just do your work in a transaction. They're all or nothing - exactly what you are after. |
 |
|
|
|
|
|
|