Andra & my Backbone

Table Variables pada SQL Server 2005

Posted in Web & Internet by Andra on February 3, 2008

Oooops gw baru tahu..
Ternyata selama ini di dalam stored procedure (SQL Server 2005),
kita dapat declare variabel dengan tipe data table

-- declare a new TABLE variable
DECLARE @Products TABLE
(ProductID INT,
Name VARCHAR(50),
Description VARCHAR(5000))

dan dapat mengisinya seperti ini..


-- populate the table variable with the complete list of products
INSERT INTO @Products
SELECT ProductID, Name, Description
FROM Product

dan kita dapat ambil data dari object tabel tersebut

-- extract the requested page of products
SELECT Name, Description FROM @Products

2 Responses

Subscribe to comments with RSS.

  1. mykatherine said, on February 7, 2008 at 2:16 am

    @anwar chandra
    tlg atur widget gw donk, ilangin “category 3″-nya gmn c?
    trus kok klo ada postingan dikirim ke email lu, bru lu fwrd ke email gw? So, plz setting klo ada postingan kirim ke email gw dl donk..
    trus di Options > general > email address, ganti jd my_katherine@hotmail.com.
    Gw udh coba ganti sendiri, tp ga dikonfim2 ke email gw.

    help!

  2. Oren said, on April 4, 2008 at 5:27 am

    yang 2000 juga uda bisa kok ndra.. ^-^


Leave a Reply