I am new to SAPDB and trying to adjust to the syntax differences from MS SQL.
I have two questions regarding translating MS SQL to SAPDB. Q1. Temporary Variables outside Stored procedures How do I declare a temporary variables outside a stored procedure? Below is a simplified version of a test script I use to check data. When using Sap's square brackets [] technique, I get 3 prompts for the same variable. DECLARE @Period INT SET @Period= 147 //<--Change this value to run for new period SELECT COUNT(*) AS Qty, 'Active' AS Status FROM CLIENTS WHERE STAUS = 'Active' AND PERIOD = @Period UNION SELECT COUNT(*) AS Qty, 'On Hold' AS Status FROM CLIENTS WHERE STAUS = 'On Hold' AND PERIOD = @Period UNION SELECT COUNT(*) AS Qty, 'Cancelled' AS Status FROM CLIENTS WHERE STAUS = 'Cancelled' AND PERIOD = @Period ------------------------------- Q2. Update one table with select from two tables. SAPDB does not seem to like more than one table in the FROM simplified example below: UPDATE C SET C.ChildPhoneNum = P.ParentPhoneNum FROM Child C, Parent P WHERE C.ParentId = P.ParentId AND C.ChildPhoneNum IS NULL ---------------------------- Arthur _______________________________________________ sapdb.general mailing list [EMAIL PROTECTED] http://listserv.sap.com/mailman/listinfo/sapdb.general
