Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Table Design Help in SQL 2005?

Author  Topic 

codingrocks
Starting Member

2 Posts

Posted - 2010-08-15 : 13:41:09
I need to design certain tables in sql. but from my asp .net application, i have an option to
add 6, 9 12, or 18 months data. So while storing the values, I need a table structure in sql 2005 to make sure that only 6 values goes in to the table if the user selects 6 months in web application. i want a table design to adapt to the scenario described above.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-08-16 : 04:54:26
how does tables tructure change whether you're storing 6,9,12 or more momnths data? The amount of data is irrelevant for designing table. Didnt understand your point here. may be you can elaborate a bit

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-08-16 : 05:09:57
use the maximum number allowed to be stored, as a parameter to the stored procedure.

Then, using your insert statement

INSERT TargetTable(Col1, Col2, Col3)
SELECT TOP(@ThisIsMyMaximumRecordsAllowedParameterForTheStoredProcedureVariable) Col1, Col2, Col3
FROM SourceTable



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -