A query..

    Date: 03/14/05 (SQL Server)    Keywords: database, asp

    A procedure I wrote that doesn't work..

    create proc cal(@days as int, @num as real output) as
    BEGIN
    DECLARE @h int, @l int, @r int, @a int, @b int, @c int, @blah real
    set @h=(select sum(heritage) from loctab);
    set @l=(select sum(leisure) from loctab);
    set @r=(select sum(religion) from loctab);
    set @a=(select heritage from loctab where locid='vzg');
    set @b=(select leisure from loctab where locid='vzg');
    set @c=(select religion from loctab where locid='vzg');

    set @blah=((@a+@b+@c)/(@h+@l+@r))*@days;
    set @num=@blah
    return @num
    END

    ***


    The value of @num should be between 2 and 3 but its returning a zero to my ASP.NET page. I think something's wrong with the division operation there. Any idea what I should do to make it work??

    Also, can I convert this into a cursor to make it work for all locid's in the database?

    Thanks.

    Source: http://www.livejournal.com/community/sqlserver/21566.html

« DTS or Stored Procs? || Proper Case formula »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home