You must Sign In to post a response.
  • Category: SQL Server

    Solve the below query

    hi every one,
    Please solve this....
    i'm trying but not getting.
    it shows 0 rows effecting.

    Declare @newdate datetime
    set @newdate=dateadd(month,2,getdate())
    update Tbl_User_Reg set SubscriptionName='Basic',CreateDate=@newdate where UserRegId='10'
  • #766818
    Hi Sadiq,

    Please check whether the table Tbl_User_Reg contains UserRegId value as 10. If it is not then it will display
    (0 row(s) affected)

    Regards,
    Simiyon A

  • #766819
    Hi,

    Have you tried this query


    select * from Tbl_User_Reg where UserRegId='10'


    Whether it returns any records?

    I guess the problem is there is no rows in that select statement, if records found for to the above statement then it will definitely update the columns and return the effected rows count.

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #766822
    Is the UserRegId varchar?.
    Can you check is there any spaces in the table data?

    Try to get
    select * from Tbl_User_Reg where UserRegId='10'

    If your are not getting any row then the problem is in the data

    select * from Tbl_User_Reg where UserRegId like '10' and check whether any spaces there in the data.

    By Nathan
    Direction is important than speed

  • #766842
    the return message itself very descriptive, if your message says '0 row affected' it does means, you have no rows that fitted in WHERE condition
    in short according to your query, check if column 'UserRegId' is having value '10'
    Hope it helps

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #766852
    Hi,
    Lot of Possibilities are there for showing this Error Messages.
    1. There is no records in the table based on UserRegid is 10
    2. May be there is no records in the table too.
    3. Otherwise, That column could not based on Varchar.

    So, Share your table structure. Or . Kindly check with the following query before executing the Update Query.

    Select * from Tbl_User_Reg where UserRegId='10'

    Regards,
    Karunanidhi.K

  • #766857
    Sidiqi

    First of all check whether the table has required data.
    after it passes check the required condition is met. i.,e

    select * from Tbl_User_Reg where UserRegId='10';


    is the possible scenarios that get 0 rows effected

    SRI RAMA PHANI BHUSHAN KAMBHAMPATI


  • Sign In to post your comments