Priming Select Count(*) into a variable

  • The following SQL returns the value 1 all the time:

    DECLARE @y INT

    SELECT

    @y = (SELECT COUNT(*)  FROM Customers)

    How can I get the select count(*) to return the actual number of Customers into @y ??

    BT
  • DECLARE @y INT

    SELECT @y = COUNT(*)  FROM Customers

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply