Re: Count(*) and Like

From: Hari Prasad (hari_prasad_k_at_hotmail.com)
Date: 07/26/04

  • Next message: Dion: "working with dates"
    Date: Mon, 26 Jul 2004 17:49:02 +0530
    
    

    HI,

    Can you please post the code for stored procedure.

    Thanks
    Hari
    MCDBA

    "kk" <anonymous@discussions.microsoft.com> wrote in message
    news:3f7d01c47304$8df40720$a601280a@phx.gbl...
    > I have a SQL statement like the below listed inside a
    > stored procedure.
    > -------------------------------
    > declare @cnt int
    > declare name varchar(250)
    > set @name = 'aaa'
    >
    > Select @cnt = count(*) from table1
    > where name like @name + '%'
    >
    > select @cnt
    > --------------------------------
    > @cnt is always zero, irrespective of how I change the
    > query even though I have more than one row in that
    > table corresponding to the Like.
    >
    > The same statement works fine from the query analyzer.
    >
    > Please advise.
    >
    >
    >
    >
    >
    >


  • Next message: Dion: "working with dates"

    Relevant Pages

    • Re: stored proc code always returns null?
      ... described by "but when i call this from inside another stored procedure ... >now the odd thing about this procedure, if the parameter of @tiercode is ... >declare @lastEffectiveDate as datetime ... >RetroContractCountsTierData.TierCode as TierCode from (retrocontractcounts ...
      (microsoft.public.sqlserver.programming)
    • Re: Stored Procedures v Views
      ... query draws the data from 4 tables. ... Do I use a stored proc or a view? ... > Just dynamically build a SQL statement using some other tool (like your VBA ... > this interface, even if your stored procedure is poorly written, you can ...
      (microsoft.public.sqlserver.programming)
    • Re: Shredding XML
      ... to determine which field values should be extracted from an XML doc ... The stored procedure works, but the process of dynamically gathering ... DECLARE keycolumns_cursor CURSOR LOCAL ... DECLARE @xPath varchar ...
      (microsoft.public.sqlserver.xml)
    • Re: ADODB.Command
      ... Try to add SET NOCOUNT ON as a very first statement ... Also declare your parameter as adParamInputOutput. ... > because the stored procedure runs another that appends tracking info, ...
      (microsoft.public.vb.database.ado)
    • Re: Cross Database Join, C++ program set up confusion
      ... the SQL statement I was trying to use in my CRecordset class in Query ... feeling that if I can get a stored procedure to generate a dynamic ... I found in MSDN documentation regarding CRecordset: ... If your tables are on the same data source, try the link I sent in my ...
      (microsoft.public.vc.database)