using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;


public partial class StoredProcedures
{
    [Microsoft.SqlServer.Server.SqlProcedure]
    public static void MaxProc1()
    {
        using (SqlConnection conn = new SqlConnection("context connection=true"))
        //using (SqlCommand cmd = new SqlCommand("select productphotoid, largephoto from Production.ProductPhoto", conn))
        //using (SqlCommand cmd = new SqlCommand("select documentid, documentsummary from Production.Document where documentsummary is not null", conn))
        using (SqlCommand cmd = new SqlCommand("select id, bigval from testbig", conn))
        {
            String s;

            conn.Open();
            SqlDataReader rdr = cmd.ExecuteReader();
            rdr.Read();
            //Console.WriteLine(rdr.GetProviderSpecificFieldType(1));
            //Object o = rdr.GetProviderSpecificValue(1);

            s = rdr.GetFieldType(1).ToString(); ;
            Object o = rdr.GetValue(1);
            String s1 = rdr.GetString(1);
            SqlString s2 = rdr.GetSqlString(1);
            s = o.GetType().ToString();
            //Console.WriteLine(((String)o).Length);

            Int64 i = s1.Length;
            i = s2.ToString().Length;
        }
    }
};
