Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

please help me convert this part into SQL Server. Expand / Collapse
Posted Wednesday, February 13, 2013 6:24 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Tuesday, July 22, 2014 2:48 PM
Points: 99, Visits: 365
IF OUT_PAT_VISIT_ID_V = 'Collected' and NO_OUT_PAT_VISIT_ID_V = 'Collected' THEN
:NEW.PAT_VISIT_ID := 'Collected';
Post #1419467
Posted Monday, March 4, 2013 11:29 PM



Group: General Forum Members
Last Login: Wednesday, July 16, 2014 3:03 AM
Points: 450, Visits: 842
It's hard to provide a translation without the rest of the code, and I don't believe blindly translating it for you would benefit you at all.

I can give you some clues though.
Those :parameters would be defined in the rest of the code you haven't supplied, probably as part of a stored procedure or a function.
IF-THEN-ELSE works almost the same in T-SQL. Read up on control-flow in T-SQL.

When you say convert to SQL Server, are you porting your database from Oracle to SQL server? If yes then you will need to define the stored procedure with input and output parameters. I suggest reading an intro to T-SQL stored procedures on MSDN. If you are familiar with PL/SQL then it will be very easy for you. If you're not then I suggest you are way out of your depth and asking for straight transliterations on a forum is a bad idea. Note I didn't say translation, because without context you can't translate any language into another language.
Post #1426607
Posted Friday, March 15, 2013 3:23 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, August 16, 2013 3:13 AM
Points: 4, Visits: 37
use select case for this issue.
Post #1431417
Posted Friday, May 24, 2013 5:39 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 12:41 PM
Points: 3,960, Visits: 2,970
From the syntax, I'm going to assume that this code is part of a trigger where you're referencing OLD AS OLD and NEW AS NEW and that it's a FOR EACH ROW. If this assumption is incorrect, you can completely ignore the rest of this post. It's been a while since I worked in Oracle.

The :NEW is a pseudo-row that refers to the row being inserted. SQL Server has the INSERTED keyword to refer to the same thing. Also, you're going to want to remove the THEN and END IF lines. Replace the ELSIF with ELSE IF statements. The last thing I see is to replace Oracle's := assignment syntax with a simple = instead.

BEGIN...END blocking is required if you have multiple statements being executed in a decision structure.

Tally Tables - Performance Personified
String Splitting with True Performance
Best practices on how to ask questions
Post #1456408
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse