I'm new to SQL Server. I have a little problem and I can't look it up. The point is that I can't get the order of data in my column STATEID
, I want to order it from min to max. I'm using the ORDER BY
or ASC
and it is not working. In what other way could I get the exact sequence min to max out of my column STATEID
. I'm using SQL Server 2008.
Here's an example of my code.
ALTER PROCEDURE [dbo].[basicGatherSelect]
@StateID nvarchar(5),
@Name nvarchar(50)
AS
BEGIN
BEGIN TRANSACTION
SET NOCOUNT ON;
SELECT
StateID, name
FROM
tblState
ORDER BY
STATEID ASC
IF @@error <> 0
BEGIN
ROLLBACK
RAISERROR ('PROBLEM', 16, 1)
RETURN
END
COMMIT
END
Results:
- 10 Liban
- 3 Rusia
- 4 Letonija
- 5 Austrija
- 7 BARAZIL
- 8 Njemacka
- 9 Argentina
- 1 Srbija
- 2 Bosna