How do i retrieve some data, an entire column of the table, while on an sql saved procedure?

After I execute the below procedure it provides me with just the last ID from the ID column.

ALTER PROCEDURE [dbo].[GetCariIdleri] @don int OUTPUT
AS
BEGIN
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT @don = ID
FROM TBLP1CARI
END

TBLCARI includes a column named ID and I wish to take all of the values for the reason that column however the result gives just the last value for the reason that column.

Thanks all for the help.

Do this:

ALTER PROCEDURE [dbo].[GetCariIdleri]

AS BEGIN SET NOCOUNT ON;

-- Insert statements for procedure here
SELECT ID
FROM TBLP1CARI

END

Your version from the proc assigns ID for an output variable - that may only have one value.

Your procedure is setting a flexible @don if you would like all of the rows just return the outcomes from the choose.

Select ID
FROM TBLP1CARI
where  <criteria>

What really will get came back technically is dependent in your RDBMS however i think its what you're searching for.

to see a power grid of information, you need to use ExecuteReader(), i.e.

using(var reader = cmd.ExecuteReader()) {
    while(reader.Read()) {
        // the first column, assuming [n][var]char()
        Console.WriteLine(reader.GetString(0));
    }
}

Having a Choose statement like:

SELECT ID
FROM TBLP1CARI

You cannot choose all individuals cells right into a single output parameter because you have multiple rows Choose is what you want rather.

that @don parameter maintains just the last id and it is came back alone take it off, or if you want it add another choose:

ALTER PROCEDURE [dbo].[GetCariIdleri]  

AS BEGIN SET NOCOUNT ON;

-- Insert statements for procedure here
SELECT ID
FROM TBLP1CARI

END

or

ALTER PROCEDURE [dbo].[GetCariIdleri]  @don int OUTPUT

AS BEGIN SET NOCOUNT ON;

-- Insert statements for procedure here
SELECT @don = ID
FROM TBLP1CARI

SELECT ID
FROM TBLP1CARI

END