Good day all. Can anyone help please.
My apologies if this is a stupid question or FAQ. I did scan the archive
first.

I am new to SAPDB and trying to adjust to the syntax differences from MS
SQL. I'm sure this basic task can be done in sapdb, it's the how I'm stuck
on.

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. I have also tried $.

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
----------------------------
Any feed back will be appreciated
Thank you,
Arthur



_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to