Sql Server Express Auto Column
Thisis my first shot at working with creating own sql database
I want to create a column of interest rates from .125 % to 21 % incremented by .125%
Is there a way to "auto" create the column so i dont have to type in each rate
And can you store percentages in a sql database? or should it be a decimal, then format before display
Thanks for any feedback and help
Re: Sql Server Express Auto Column
This gives a result from 0.123 to 21
Code:
; WITH aa AS (
SELECT CAST(0.125 AS FLOAT) AS Num
UNION ALL
SELECT CAST(Num + 0.125 AS FLOAT)
FROM aa
WHERE Num < 21
)
SELECT *
FROM aa
OPTION (MAXRECURSION 0)
Re: Sql Server Express Auto Column
Thanks, I should have been more specific and said at design time
I am adding a table to my database that will store these numbers that my dopdownlist will contain so the user at run time cant mis-type wrong data.
It just seems silly to have to manually enter each one in
Re: Sql Server Express Auto Column
If the user is going to enter - at run time - the table values - how else could you get them into a table??
Re: Sql Server Express Auto Column
Quote:
Originally Posted by
szlamany
If the user is going to enter - at run time - the table values - how else could you get them into a table??
In my second post I said at "Design time" user will not be entering the values
Again I apologize for not being more specific in my initial post
Re: Sql Server Express Auto Column
well you can use the query that CVM supplied to INSERT INTO your table...
-tg