summaryrefslogtreecommitdiff
path: root/tests/simple_unit/SqlMap/scripts/mssql/swap-procedure.sql
diff options
context:
space:
mode:
authorwei <>2006-12-04 02:42:57 +0000
committerwei <>2006-12-04 02:42:57 +0000
commit562979c4a8fe47952edf7986d4144624e41630f7 (patch)
treeb79c3fd28e1aedb40d04e148da4b0763c928a3a5 /tests/simple_unit/SqlMap/scripts/mssql/swap-procedure.sql
parent91fe694c8755aa2d05743946a3681be7232420b6 (diff)
add unit tests for active record and sqlmap
Diffstat (limited to 'tests/simple_unit/SqlMap/scripts/mssql/swap-procedure.sql')
-rw-r--r--tests/simple_unit/SqlMap/scripts/mssql/swap-procedure.sql34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/simple_unit/SqlMap/scripts/mssql/swap-procedure.sql b/tests/simple_unit/SqlMap/scripts/mssql/swap-procedure.sql
new file mode 100644
index 00000000..203ab60d
--- /dev/null
+++ b/tests/simple_unit/SqlMap/scripts/mssql/swap-procedure.sql
@@ -0,0 +1,34 @@
+CREATE PROCEDURE dbo.[ps_swap_email_address]
+@First_Email [nvarchar] (64) output,
+@Second_Email [nvarchar] (64) output
+AS
+
+Declare @ID1 int
+Declare @ID2 int
+
+Declare @Email1 [nvarchar] (64)
+Declare @Email2 [nvarchar] (64)
+
+ SELECT @ID1 = Account_ID, @Email1 = Account_Email
+ from Accounts
+ where Account_Email = @First_Email
+
+ SELECT @ID2 = Account_ID, @Email2 = Account_Email
+ from Accounts
+ where Account_Email = @Second_Email
+
+ UPDATE Accounts
+ set Account_Email = @Email2
+ where Account_ID = @ID1
+
+ UPDATE Accounts
+ set Account_Email = @Email1
+ where Account_ID = @ID2
+
+ SELECT @First_Email = Account_Email
+ from Accounts
+ where Account_ID = @ID1
+
+ SELECT @Second_Email = Account_Email
+ from Accounts
+ where Account_ID = @ID2