|
-
Apr 12th, 2010, 01:45 PM
#1
[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!
Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
save a blobFileStreamDataTable To Text Filemy blog
-
Apr 12th, 2010, 02:00 PM
#2
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;
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
Apr 12th, 2010, 02:08 PM
#3
Re: Translation required: PLSQL to T-SQL
 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?
Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
save a blobFileStreamDataTable To Text Filemy blog
-
Apr 12th, 2010, 02:11 PM
#4
Re: Translation required: PLSQL to T-SQL
 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).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|