table structure


hi,

in application using asp.net  table 4 columns id,desc,quantity,price   with 5 rows .

id         descdription   quantity               price

txtbx1     txtbxdesc1       txtbxquant1     txtbxprice1

txtbx2    txtbxdesc2       txtbxquant 2    txtbxprice2

txtbx3    txtbxdesc3       txtbxquant3     txtbxprice3

txtbx4   txtbxdesc4     txtbxquant4    txtbxprice4

txtbx5     txtbxdesc5     txtbxquant5    txtbxprice5

                                                 total     txttotal

rtnow  create  database table  

create table [dbo].[project_itemtest](  	[id] [int] identity(1,1) not null,  	[pid] [int] not null,  	[item] [varchar](150) null,  	[description] [varchar](max) null,  	[quantity] [varchar](max) null,  	[price] [varchar](50) null,  	[item1] [varchar](50) null,  	[desc1] [varchar](max) null,  	[quantity1] [varchar](max) null,  	[price1] [varchar](50) null,  	[item2] [varchar](150) null,  	[desc2] [varchar](max) null,  	[quantity2] [varchar](max) null,  	[price2] [varchar](50) null,  	[item3] [varchar](150) null,  	[desc3] [varchar](max) null,  	[quantity3] [varchar](max) null,  	[price3] [varchar](50) null,  	[item4] [varchar](150) null,  	[desc4] [varchar](max) null,  	[quantity4] [varchar](max) null,  	[price4] [varchar](50) null,  	[totalprice] [varchar](50) null  ) on [primary]  
if there more 5 rows need add more columns in databse.please give suggestions can modify table structure in database.

nope. not design

you should store them rows fields as

create table [dbo].[project_itemtest]( 	[id] [int] identity(1,1) not null, 	[pid] [int] not null, 	[item] [varchar](150) null, 	[description] [varchar](max) null, 	[quantity] [varchar](max) null,
)

then able summraize them rowwise , total want

no need of keeping on adding columns each new value


please mark answer if helps solve issue visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/vmblogs



SQL Server  >  Getting started with SQL Server



Comments

Popular posts from this blog

Motherboard replacement

Cannot create Full Text Search catalog after upgrading to V12 - Database is not fully started up or it is not in an ONLINE state

Remote Desktop App - Error 0x207 or 0x607