[RESOLVED] Translation required: PLSQL to T-SQL
Hello Folks,
I have the following PL/SQL code that needs to be translated to T-SQL for SQL Server.
sql Code:
DECLARE
x INTEGER := 100;
y INTEGER := 10;
BEGIN
WHILE x != 110 LOOP
INSERT INTO tab_for_nulls(rollno, marks) VALUES(x, y);
x:=x+1;
END LOOP;
END;
Thanks!
Re: Translation required: PLSQL to T-SQL
Try this:
Code:
DECLARE @x INTEGER
DECLARE @y INTEGER
SELECT @x= 100, @y = 10
BEGIN
WHILE x <> 110
INSERT INTO tab_for_nulls(rollno, marks) VALUES(@x, @y)
Set @x = @x+1
END
END;
Re: Translation required: PLSQL to T-SQL
Quote:
Originally Posted by
GaryMazzone
Try this:
Code:
DECLARE @x INTEGER
DECLARE @y INTEGER
SELECT @x= 100, @y = 10
BEGIN
WHILE x <> 110
INSERT INTO tab_for_nulls(rollno, marks) VALUES(@x, @y)
Set @x = @x+1
END
END;
Thanks for jogging my memory.
Here's your code with syntax issues fixed.
SQL Code:
DECLARE @x INTEGER
DECLARE @y INTEGER
SELECT @x= 100, @y = 10
BEGIN
WHILE @x <> 110
BEGIN
INSERT INTO
[TAB_FOR_NULLS]([ROLLNO],[MARKS])
VALUES(@x, @y)
Set @x = @x+1
END
END
GO
I heard that you can write C# code in SQL 2008. Have you given that a whirl?
Re: Translation required: PLSQL to T-SQL
Quote:
Originally Posted by
abhijit
I heard that you can write C# code in SQL 2008. Have you given that a whirl?
There is a link in the "SQL Server" section of our Database Development FAQs/Tutorials to a fairly simple tutorial on it (for VB.Net, but it should be virtually identical).