Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2003
    Posts
    7

    Question Unanswered: [howto] write a function that process row collection

    something like max,min?
    help please!!!

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    SQL Server doesn't extend that level of functionality to end users yet.

    -PatP

  3. #3
    Join Date
    Nov 2003
    Posts
    7
    thank you.
    another question:
    is it avaliable in the most recent sql server version(v2005)?

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    I can't answer that question. Sorry.

    -PatP

  5. #5
    Join Date
    Nov 2003
    Posts
    7

  6. #6
    Join Date
    Nov 2003
    Posts
    7
    looks great
    ==========================================
    using System.Data.SqlServer;
    using System.Data.Sql;
    public class T {
    [SqlFunc]
    [SqlFunction(DataAccess = DataAccessKind.Read)]
    public static int ReturnOrderCount()
    {
    SqlCommand sqlComm = SqlContext.GetCommand();

    sqlComm.CommandText = "SELECT COUNT(*) AS 'Order Count' FROM SalesOrderHeader";

    return (int) sqlComm.ExecuteScalar();
    }
    }

    -------------------------------------------------------------------------------
    Using System.Data.Sql;
    Using System.Data.SqlServer;
    Class T {
    [SqlProcedure]
    public static void HelloWorld()
    {
    SqlPipe sp = SqlContext.GetPipe();

    sp.Send("Hello world! It's now " + System.DateTime.Now.ToString()+"\n");
    SqlCommand cmd = SqlContext.GetCommand()
    cmd.CommandText = “SELECT ProductNumber FROM ProductMaster”
    SqlDataReader rdr = cmd.ExecuteReader();
    Sp.Send(rdr);
    }
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •