|
-
Jan 21st, 2012, 11:06 PM
#1
Thread Starter
Frenzied Member
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
-
Jan 22nd, 2012, 02:57 AM
#2
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)
-
Jan 22nd, 2012, 04:11 AM
#3
Thread Starter
Frenzied Member
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
-
Jan 22nd, 2012, 09:59 AM
#4
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??
-
Jan 22nd, 2012, 06:22 PM
#5
Thread Starter
Frenzied Member
Re: Sql Server Express Auto Column
 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
-
Jan 22nd, 2012, 06:24 PM
#6
Re: Sql Server Express Auto Column
well you can use the query that CVM supplied to INSERT INTO your table...
-tg
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
|