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 2008 Forums
 Transact-SQL (2008)
 insert data to table

Author  Topic 

papershop
Starting Member

27 Posts

Posted - 2011-07-23 : 19:14:51
hi reader

i have some problem with my program, i hope you all can help me

i have table

machine startdate interval Jan Feb Marc Apr Mei Jun Jul Agus sept okt
______________________________________________________________________

if i insert data machine id = 101, startdate=12/02/2011 and interval=2

what should id do if i want the data like this

machine startdate interval Jan Feb Marc Apr Mei Jun Jul Agus sep okt
______________________________________________________________________
101 12/02/2011 1 X X X X X

the 'X' will automatic inputted to the table with interval 2 month

please help me

@papershop

karthick.amace
Starting Member

23 Posts

Posted - 2011-07-23 : 23:27:06
HI,
You can use Trigger to that table, so that if interval value comes as 2 you can insert 'X' in Jan - Okt column.

------------------------------------------------------
"Desire makes what you wants to do"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-07-24 : 00:52:58
how did interval 2 became 1? can you explain your output?

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

Go to Top of Page

papershop
Starting Member

27 Posts

Posted - 2011-07-24 : 05:21:10
hi reader


if i insert data machine id = 101, startdate=12/02/2011 and interval=2

what should id do if i want the data like this

machine startdate interval Jan Feb Marc Apr Mei Jun Jul Agus sep okt
______________________________________________________________________
101 12/02/2011 2 X X X X X

the 'X' will automatic inputted to the table with interval 2 month

please help me

@papershop

@papershop
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-07-24 : 05:32:05
can you use [code] [/code] tag to format your output ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -