RE : Re: RE : Re: Reuse of statement in an other statement

View: New views
6 Messages — Rating Filter:   Alert me  

RE : Re: RE : Re: Reuse of statement in an other statement

by Régis BRULEY :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok thanks a lot ! I'll try it right on my return on my computer.

have a nice week End.

Bye

Régis

Le 10 juil. 2009, 7:07 PM, "Michael McCurrey" <mmccurrey@...> a écrit :

You can't have your statement pass a dynamic parameter to that; however, you can 'catch' statement parameters in your sql fragment.

For example:
    <sql id="Fragment">
      insert into MySuperTable(Column1) values(#MyVariable,type=String,dbType=VarChar#)
    </sql>

On Fri, Jul 10, 2009 at 9:57 AM, Régis BRULEY <regis@...> wrote: > > Hi, > > Test that's he...


Using SQL Server 2k8 - Table Value Parameters in iBatis .net

by Srinivas.Junnuru :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hello,

Any example or input on how to pass Table Value Parameters (which are supported in Sql Server 2008)  to a Stored Proc using IBatis.net Data Mapper?  I am using Data Mapper 1.6.1

 

 

Here is a link on how to use TVPs  using Sql ADO .net provider directly. Not able to get this to work thru iBatis.

http://msdnrss.thecoderblogs.com/2009/03/20/table-value-parameter-used-in-net-simple-sample/

 

 

Thanks in advance

-Srini

 

 

 


From: regis.bruley@... [mailto:regis.bruley@...] On Behalf Of Régis BRULEY
Sent: Friday, July 10, 2009 12:20 PM
To: user-cs@...; michael@...
Subject: RE : Re: RE : Re: Reuse of statement in an other statement

 

Ok thanks a lot ! I'll try it right on my return on my computer.

have a nice week End.

Bye

Régis

Le 10 juil. 2009, 7:07 PM, "Michael McCurrey" <mmccurrey@...> a écrit :

You can't have your statement pass a dynamic parameter to that; however, you can 'catch' statement parameters in your sql fragment.

For example:
    <sql id="Fragment">
      insert into MySuperTable(Column1) values(#MyVariable,type=String,dbType=VarChar#)
    </sql>

On Fri, Jul 10, 2009 at 9:57 AM, Régis BRULEY <regis@...> wrote: > > Hi, > > Test that's he...


RE: Using SQL Server 2k8 - Table Value Parameters in iBatis .net

by Srinivas.Junnuru :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Nevermind.

I got it working by creating a Custom Type Handler for this particular datatype i.e. SqlDbType.Structured

 

Thanks

-Srini

 


From: Srinivas.Junnuru [mailto:Srinivas.Junnuru@...]
Sent: Saturday, July 11, 2009 12:49 PM
To: user-cs@...; michael@...
Subject: Using SQL Server 2k8 - Table Value Parameters in iBatis .net

 

Hello,

Any example or input on how to pass Table Value Parameters (which are supported in Sql Server 2008)  to a Stored Proc using IBatis.net Data Mapper?  I am using Data Mapper 1.6.1

 

 

Here is a link on how to use TVPs  using Sql ADO .net provider directly. Not able to get this to work thru iBatis.

http://msdnrss.thecoderblogs.com/2009/03/20/table-value-parameter-used-in-net-simple-sample/

 

 

Thanks in advance

-Srini

 

 

 


From: regis.bruley@... [mailto:regis.bruley@...] On Behalf Of Régis BRULEY
Sent: Friday, July 10, 2009 12:20 PM
To: user-cs@...; michael@...
Subject: RE : Re: RE : Re: Reuse of statement in an other statement

 

Ok thanks a lot ! I'll try it right on my return on my computer.

have a nice week End.

Bye

Régis

Le 10 juil. 2009, 7:07 PM, "Michael McCurrey" <mmccurrey@...> a écrit :

You can't have your statement pass a dynamic parameter to that; however, you can 'catch' statement parameters in your sql fragment.

For example:
    <sql id="Fragment">
      insert into MySuperTable(Column1) values(#MyVariable,type=String,dbType=VarChar#)
    </sql>

On Fri, Jul 10, 2009 at 9:57 AM, Régis BRULEY <regis@...> wrote: > > Hi, > > Test that's he...


RE: Using SQL Server 2k8 - Table Value Parameters in iBatis .net

by Srinivas.Junnuru :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Just a followup.

Hoping that this feature will be supported out of the box in the next version of DataMapper that targets .NET 3.5 and later.

 

Thanks

-Srini

 


From: Srinivas.Junnuru [mailto:Srinivas.Junnuru@...]
Sent: Saturday, July 11, 2009 5:09 PM
To: user-cs@...; michael@...
Subject: RE: Using SQL Server 2k8 - Table Value Parameters in iBatis .net

 

Nevermind.

I got it working by creating a Custom Type Handler for this particular datatype i.e. SqlDbType.Structured

 

Thanks

-Srini

 


From: Srinivas.Junnuru [mailto:Srinivas.Junnuru@...]
Sent: Saturday, July 11, 2009 12:49 PM
To: user-cs@...; michael@...
Subject: Using SQL Server 2k8 - Table Value Parameters in iBatis .net

 

Hello,

Any example or input on how to pass Table Value Parameters (which are supported in Sql Server 2008)  to a Stored Proc using IBatis.net Data Mapper?  I am using Data Mapper 1.6.1

 

 

Here is a link on how to use TVPs  using Sql ADO .net provider directly. Not able to get this to work thru iBatis.

http://msdnrss.thecoderblogs.com/2009/03/20/table-value-parameter-used-in-net-simple-sample/

 

 

Thanks in advance

-Srini

 

 

 


From: regis.bruley@... [mailto:regis.bruley@...] On Behalf Of Régis BRULEY
Sent: Friday, July 10, 2009 12:20 PM
To: user-cs@...; michael@...
Subject: RE : Re: RE : Re: Reuse of statement in an other statement

 

Ok thanks a lot ! I'll try it right on my return on my computer.

have a nice week End.

Bye

Régis

Le 10 juil. 2009, 7:07 PM, "Michael McCurrey" <mmccurrey@...> a écrit :

You can't have your statement pass a dynamic parameter to that; however, you can 'catch' statement parameters in your sql fragment.

For example:
    <sql id="Fragment">
      insert into MySuperTable(Column1) values(#MyVariable,type=String,dbType=VarChar#)
    </sql>

On Fri, Jul 10, 2009 at 9:57 AM, Régis BRULEY <regis@...> wrote: > > Hi, > > Test that's he...


Re: Using SQL Server 2k8 - Table Value Parameters in iBatis .net

by Michael McCurrey-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm looking into it Srini.  I'm more of a non-sql server guy myself so I'm trying to get a handle on it.


On Sat, Jul 11, 2009 at 3:12 PM, Srinivas.Junnuru <Srinivas.Junnuru@...> wrote:

Just a followup.

Hoping that this feature will be supported out of the box in the next version of DataMapper that targets .NET 3.5 and later.

 

Thanks

-Srini

 


From: Srinivas.Junnuru [mailto:Srinivas.Junnuru@...]
Sent: Saturday, July 11, 2009 5:09 PM

Subject: RE: Using SQL Server 2k8 - Table Value Parameters in iBatis .net

 

Nevermind.

I got it working by creating a Custom Type Handler for this particular datatype i.e. SqlDbType.Structured

 

Thanks

-Srini

 


From: Srinivas.Junnuru [mailto:Srinivas.Junnuru@...]
Sent: Saturday, July 11, 2009 12:49 PM
To: user-cs@...; michael@...
Subject: Using SQL Server 2k8 - Table Value Parameters in iBatis .net

 

Hello,

Any example or input on how to pass Table Value Parameters (which are supported in Sql Server 2008)  to a Stored Proc using IBatis.net Data Mapper?  I am using Data Mapper 1.6.1

 

 

Here is a link on how to use TVPs  using Sql ADO .net provider directly. Not able to get this to work thru iBatis.

http://msdnrss.thecoderblogs.com/2009/03/20/table-value-parameter-used-in-net-simple-sample/

 

 

Thanks in advance

-Srini

 

 

 


From: regis.bruley@... [mailto:regis.bruley@...] On Behalf Of Régis BRULEY
Sent: Friday, July 10, 2009 12:20 PM
To: user-cs@...; michael@...
Subject: RE : Re: RE : Re: Reuse of statement in an other statement

 

Ok thanks a lot ! I'll try it right on my return on my computer.

have a nice week End.

Bye

Régis

Le 10 juil. 2009, 7:07 PM, "Michael McCurrey" <mmccurrey@...> a écrit :

You can't have your statement pass a dynamic parameter to that; however, you can 'catch' statement parameters in your sql fragment.

For example:
    <sql id="Fragment">
      insert into MySuperTable(Column1) values(#MyVariable,type=String,dbType=VarChar#)
    </sql>

On Fri, Jul 10, 2009 at 9:57 AM, Régis BRULEY <regis@...> wrote: > > Hi, > > Test that's he...




--
Michael J. McCurrey
Read with me at http://www.mccurrey.com
http://chaoticmindramblings.blogspot.com/

RE: Using SQL Server 2k8 - Table Value Parameters in iBatis .net

by Srinivas.Junnuru :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Thanks Mike.

 

The custom type handler for the SqlDbType.Structured that worked for me is as simple as this:

 

    /// <summary>

    /// Custom Type Handler class for iBatis to support the Structured SqlDbType in .NET which is

    /// needed to support the Table Value Parameter (TVP) type in SQL2k8

    /// </summary>

    public class SQLStructuredTypeHandler : ITypeHandlerCallback

    {

 

        /// <summary>

        /// Return the same value from the current getter

        /// </summary>

        /// <param name="getter"></param>

        /// <returns></returns>

        public object GetResult(IResultGetter getter)

        {

            return getter.Value;

        }

 

        /// <summary>

        /// Return the nullable equivalent as null;

        /// </summary>

        public object NullValue

        {

            get { return null; }

        }

 

        /// <summary>

        /// Set the SqlDbType to Structured and set the setter's value to the parameter value

        /// </summary>

        /// <param name="setter"></param>

        /// <param name="parameter"></param>

        public void SetParameter(IParameterSetter setter, object parameter)

        {

            SqlParameter sqlp = (SqlParameter)setter.DataParameter;

            sqlp.SqlDbType = SqlDbType.Structured;

            setter.Value = parameter;

        }

 

        /// <summary>

        /// Return the parsed value of this type from a string

        /// </summary>

        /// <param name="s"></param>

        /// <returns></returns>

        public object ValueOf(string s)

        {

            return s;

        }

    }

 

Srini Junnuru | Sr. Technical Consultant l ¤TARGET Stores Development l 612.304.8167(office) | 612.304.6300(fax)

From: Michael McCurrey [mailto:mmccurrey@...]
Sent: Sunday, July 12, 2009 10:39 AM
To: user-cs@...
Subject: Re: Using SQL Server 2k8 - Table Value Parameters in iBatis .net

 

I'm looking into it Srini.  I'm more of a non-sql server guy myself so I'm trying to get a handle on it.

On Sat, Jul 11, 2009 at 3:12 PM, Srinivas.Junnuru <Srinivas.Junnuru@...> wrote:

Just a followup.

Hoping that this feature will be supported out of the box in the next version of DataMapper that targets .NET 3.5 and later.

 

Thanks

-Srini

 


From: Srinivas.Junnuru [mailto:Srinivas.Junnuru@...]
Sent: Saturday, July 11, 2009 5:09 PM

Subject: RE: Using SQL Server 2k8 - Table Value Parameters in iBatis .net

 

Nevermind.

I got it working by creating a Custom Type Handler for this particular datatype i.e. SqlDbType.Structured

 

Thanks

-Srini

 


From: Srinivas.Junnuru [mailto:Srinivas.Junnuru@...]
Sent: Saturday, July 11, 2009 12:49 PM
To: user-cs@...; michael@...
Subject: Using SQL Server 2k8 - Table Value Parameters in iBatis .net

 

Hello,

Any example or input on how to pass Table Value Parameters (which are supported in Sql Server 2008)  to a Stored Proc using IBatis.net Data Mapper?  I am using Data Mapper 1.6.1

 

 

Here is a link on how to use TVPs  using Sql ADO .net provider directly. Not able to get this to work thru iBatis.

http://msdnrss.thecoderblogs.com/2009/03/20/table-value-parameter-used-in-net-simple-sample/

 

 

Thanks in advance

-Srini

 

 

 


From: regis.bruley@... [mailto:regis.bruley@...] On Behalf Of Régis BRULEY
Sent: Friday, July 10, 2009 12:20 PM
To: user-cs@...; michael@...
Subject: RE : Re: RE : Re: Reuse of statement in an other statement

 

Ok thanks a lot ! I'll try it right on my return on my computer.

have a nice week End.

Bye

Régis

Le 10 juil. 2009, 7:07 PM, "Michael McCurrey" <mmccurrey@...> a écrit :

You can't have your statement pass a dynamic parameter to that; however, you can 'catch' statement parameters in your sql fragment.

For example:
    <sql id="Fragment">
      insert into MySuperTable(Column1) values(#MyVariable,type=String,dbType=VarChar#)
    </sql>

On Fri, Jul 10, 2009 at 9:57 AM, Régis BRULEY <regis@...> wrote: > > Hi, > > Test that's he...




--
Michael J. McCurrey
Read with me at http://www.mccurrey.com
http://chaoticmindramblings.blogspot.com/