Helpp

Jul 24, 2007

I have a table that contains two column as below
A B
1 0
1 1
1 2
1 3
2 0
2 1
2 5
3 0
3 3
3 7

I want to select A which B columns include 0 and 1 so return value must be 1 and 2. how can i write sql command?

View 4 Replies


ADVERTISEMENT

Helpp...urgent

Jan 10, 2008

i want haveing a problem with conversion...

I have values like 234.567 , 33.567
and i want to display only 3 significat digits.
means

234.567= 235
3.456=3.46
12.567=12.6

can anybody help out.

View 7 Replies View Related

[ask] Trigger In Sqlserver Not Working, HELPP!!

May 9, 2007

i have this trigger in my database : ALTER TRIGGER dbo.AddVoucher    ON  dbo.User_AddVoucher    AFTER INSERTAS     SET NOCOUNT ON;DECLARE @UserId int,     @Add_id int,     @voucher_id char,     @Kredit money,     @date smalldatetime,     @last_balance money,     @voucher_status charSELECT @UserId = UserId,     @voucher_id = Voucher_ID,     @Add_id = Add_id,     @date = Deposit_Date    FROM InsertedSELECT @Kredit= Voucher_Value,     @voucher_status = Voucher_Status     FROM Voucher     WHERE Voucher_ID = @voucher_idINSERT INTO User_Balance(AddVoucher_ID, UserId, Update_Type, Update_Date)    VALUES     (@Add_id,@UserId, 'Kredit',@date)select @last_balance = Balance    from User_Balance     WHERE UserId = @UserId and Balance = (select TOP 1 Balance User_Balance where UserId = @UserId order by Update_Id DESC) if (@voucher_status = 'active')    -- SET NOCOUNT ON added to prevent extra result sets from    -- interfering with SELECT statements.    -- Insert statements for trigger hereBEGIN    update User_Balance    set Balance = @last_balance + @Kredit    where AddVoucher_ID = @Add_id    update Voucher    set Sold_Date = @date    where Voucher_ID = @voucher_idENDELSE BEGIN    raiserror ('Voucher is not valid',0,1)    rollback transaction ENDgo  the problem is the update function is not working and the if statement always put to 'FALSE' do you think anything wrong with the code 

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved