how to fill value in colu;mn is active

Posted by Shanky11 under Sql Server on 3/22/2013 | Points: 10 | Views : 950 | Status : [Member] | Replies : 7
u have a table in sql server in it ;columns are
message id ,message chapter ,session, word ,is Active
I have to fill data in it
how can i fill data to isActive column
session chapter word can be null so leave it
mesasage id is unique identifier




Responses

Posted by: .Netlearner on: 3/22/2013 [Member] Starter | Points: 25

Up
0
Down
Hello,

Can you please make your question more clear. Do you need a query to insert data in the table

as follows ?

MessageID|MessageChapter|Session|Word|IsActive
----------------------------------------------------------------------
1 null null null 1

Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: .Netlearner on: 3/22/2013 [Member] Starter | Points: 25

Up
0
Down
And the "IS Active" Column is of what datatype? is that boolean?

Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Shanky11 on: 3/22/2013 [Member] Starter | Points: 25

Up
0
Down
yes i need to fill this row by my own
message id ,message ,chapter ,session,word,is Active
chapter ,session,word these columns can be null

Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Shanky11 on: 3/22/2013 [Member] Starter | Points: 25

Up
0
Down
bit

Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: .Netlearner on: 3/22/2013 [Member] Starter | Points: 25

Up
0
Down
Use the following Query,Just enter 0 or 1 value for Is Active Field.

U can either specify the values for chapter,session,word nor just dont mention as those fields allow null.

insert into tblname values(1,''message','chapter',session','word',0)

Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Shanky11 on: 3/22/2013 [Member] Starter | Points: 25

Up
0
Down
see what am i doing
i m fillingmessage column and message id is unique identifier so no need to fill this chapter sesso=ion word are null
isActive i tried 0,1 but it shoing error
strng was not recognised as valid boolean

Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 3/22/2013 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Try this Code.

-- Set which Field Do u need null put allow null option in sql Table Design
--Table Script and Insert Query

CREATE TABLE [dbo].[Table10](
[Id] [int] IDENTITY(1,1) NOT NULL,
[MessageID] [varchar](50) NULL,
[MessageChapter] [varchar](50) NULL,
[IsActive] [bit] NULL,
CONSTRAINT [PK_Table10] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]


Insert INTO Table10 VALUES('Test2','TestChapter2',NULL)


--Mark as answer if it is useful to u

Mark as Answer if its helpful to you

Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response