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)
 Stored procedure with bit datatype

Author  Topic 

CRP
Starting Member

10 Posts

Posted - 2008-03-26 : 02:18:53
Hi guys,

I have a table with following columns and records.

Empid Empname Phone Flag

14 Rajan 2143 1
16 Balan 4321 1
22 Nalini 3456 0
23 Ganesh 9543 0

My requirement is when i delete a record based on empid that record's flag should be set to 1 if it is 0.Actually it should not delete. It should update the flag value. If the flag is already 1 for that particular empid then it should remain as it is. After deletion when i issue "select * from table name", the deleted record (update record) should not be displayed. Only the records with the flag value 0 alone should be displayed in the select statement.

Pls provide me the full stored procedure code

Thanx


C.R.P RAJAN

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-03-26 : 03:42:43
Is this homwework?

-- "Delete"
UPDATE Table1 SET Flag = 1 WHERE Flag = 0 AND {other criterias here}

-- "Select"
SELECT * FROM Table1 WHERE Flag = 0



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

sk_20012
Starting Member

1 Post

Posted - 2008-03-26 : 04:22:14
I want to display 40th value from a table ? Can any body help me.
i have a table with hundreds of rows and i want to select only 40th largest row....please help me ?

Thanx in advance
Go to Top of Page

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2008-03-26 : 04:29:27
quote:
Originally posted by sk_20012

I want to display 40th value from a table ? Can any body help me.
i have a table with hundreds of rows and i want to select only 40th largest row....please help me ?

Thanx in advance



start a new thread, and provide some more detail / sample data, DDL etc

Em
Go to Top of Page
   

- Advertisement -