Showing posts with label inside. Show all posts
Showing posts with label inside. Show all posts

Friday, March 23, 2012

How to create and schedule full-text catalogue

Hi,
I have writen a database installation application that simply creates
tables inside a database. I also need to create and schedule
full-text indexing on some of my tables.
I am using SQL server 2000 and and VB.NET 2003.
Thank you,
_dino_You could generate scripts for full-text indexes from Enterprise Manager.
Here's how the scripts look like for example:
http://www.databasejournal.com/features/mssql/article.php/1459591
--
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Dino Buljubasic" <dino@.noplacelikehome.com> wrote in message
news:jgale198gjv7suate4st95si2v5it5tbf4@.4ax.com...
> Hi,
> I have writen a database installation application that simply creates
> tables inside a database. I also need to create and schedule
> full-text indexing on some of my tables.
> I am using SQL server 2000 and and VB.NET 2003.
> Thank you,
> _dino_
>|||Thank you
On Sat, 30 Jul 2005 11:30:20 +0100, "Narayana Vyas Kondreddi"
<answer_me@.hotmail.com> wrote:
>You could generate scripts for full-text indexes from Enterprise Manager.
>Here's how the scripts look like for example:
>http://www.databasejournal.com/features/mssql/article.php/1459591|||thank you
On Sat, 30 Jul 2005 11:30:20 +0100, "Narayana Vyas Kondreddi"
<answer_me@.hotmail.com> wrote:
>You could generate scripts for full-text indexes from Enterprise Manager.
>Here's how the scripts look like for example:
>http://www.databasejournal.com/features/mssql/article.php/1459591

How to create and schedule full-text catalogue

Hi,
I have writen a database installation application that simply creates
tables inside a database. I also need to create and schedule
full-text indexing on some of my tables.
I am using SQL server 2000 and and VB.NET 2003.
Thank you,
_dino_
You could generate scripts for full-text indexes from Enterprise Manager.
Here's how the scripts look like for example:
http://www.databasejournal.com/featu...le.php/1459591
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Dino Buljubasic" <dino@.noplacelikehome.com> wrote in message
news:jgale198gjv7suate4st95si2v5it5tbf4@.4ax.com...
> Hi,
> I have writen a database installation application that simply creates
> tables inside a database. I also need to create and schedule
> full-text indexing on some of my tables.
> I am using SQL server 2000 and and VB.NET 2003.
> Thank you,
> _dino_
>
|||Thank you
On Sat, 30 Jul 2005 11:30:20 +0100, "Narayana Vyas Kondreddi"
<answer_me@.hotmail.com> wrote:

>You could generate scripts for full-text indexes from Enterprise Manager.
>Here's how the scripts look like for example:
>http://www.databasejournal.com/featu...le.php/1459591
|||thank you
On Sat, 30 Jul 2005 11:30:20 +0100, "Narayana Vyas Kondreddi"
<answer_me@.hotmail.com> wrote:

>You could generate scripts for full-text indexes from Enterprise Manager.
>Here's how the scripts look like for example:
>http://www.databasejournal.com/featu...le.php/1459591

How to create and schedule full-text catalogue

Hi,
I have writen a database installation application that simply creates
tables inside a database. I also need to create and schedule
full-text indexing on some of my tables.
I am using SQL server 2000 and and VB.NET 2003.
Thank you,
_dino_You could generate scripts for full-text indexes from Enterprise Manager.
Here's how the scripts look like for example:
http://www.databasejournal.com/feat...cle.php/1459591
--
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Dino Buljubasic" <dino@.noplacelikehome.com> wrote in message
news:jgale198gjv7suate4st95si2v5it5tbf4@.
4ax.com...
> Hi,
> I have writen a database installation application that simply creates
> tables inside a database. I also need to create and schedule
> full-text indexing on some of my tables.
> I am using SQL server 2000 and and VB.NET 2003.
> Thank you,
> _dino_
>|||Thank you
On Sat, 30 Jul 2005 11:30:20 +0100, "Narayana Vyas Kondreddi"
<answer_me@.hotmail.com> wrote:

>You could generate scripts for full-text indexes from Enterprise Manager.
>Here's how the scripts look like for example:
>http://www.databasejournal.com/feat...cle.php/1459591|||thank you
On Sat, 30 Jul 2005 11:30:20 +0100, "Narayana Vyas Kondreddi"
<answer_me@.hotmail.com> wrote:

>You could generate scripts for full-text indexes from Enterprise Manager.
>Here's how the scripts look like for example:
>http://www.databasejournal.com/feat...cle.php/1459591

Monday, March 19, 2012

How to create a second independent transaction inside a CLR stored procedure?

I use the context connection for the "normal" work in the CLR procedure.
But I need to commit some data in every case. So I need to create a second transaction which is independent from the calling transaction.

What is the best way to do this inside a CLR procedure?

Thanx a lot

Hi!

Create another connection to the server and create a transaction on this second connection. Please note that since your main connection is inproc (“context connection=true” in the connection string), the second connection should be non-inproc (network. Of cause, you can connect to the same server.).

|||Thank you,

I tried this already. But I got an error when I call BeginTransaction on the second connection. When I remember correctly it as "Transcation already in use by another session". I call the procedure from t-sql inside a begin tran block

Any idea about that?

I will try to build a small example an post it here.|||

Hello,
I made a small example to reproduce the error.

CLR procedure
<Microsoft.SqlServer.Server.SqlProcedure()> _

Public Shared Sub Test(ByVal sConnectString As String)

Dim t As SqlClient.SqlTransaction = Nothing

Dim c As SqlClient.SqlConnection = Nothing

c = New SqlClient.SqlConnection(sConnectString)

c.Open()

t = c.BeginTransaction()

t.Commit()

c.Close()

End Sub

T-SQL caller:
begin tran
execute Test 'Server=(local);database=cpwerx;user Id=sa;password=xyz'
commit tran

Error:
A .NET Framework error occurred during execution of user defined routine or aggregate 'Cas':
System.Data.SqlClient.SqlException: Transaction context in use by another session.
System.Data.SqlClient.SqlException:
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[] buffer, TransactionManagerRequestType request, String transactionName, TransactionManagerIsolationLevel isoLevel, Int32 timeout, SqlInternalTransaction transaction, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlInternalConnectionTds.PropagateTransactionCookie(Byte[] cookie)
at System.Data.SqlClient.SqlInternalConnection.EnlistNonNull(Transaction tx)
at System.Data.SqlClient.SqlInternalConnection.Enlist(Transaction tx)
at System.Data.SqlClient.SqlInternalConnectionTds.Activate(Transaction transaction)
at System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(Transaction transaction)
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()

|||

Hi!

Modify your connection string so that it has "Enlist=false" in it. Otherwise the connection inherits current transaction.

More on "Enlist" option is in doc on SqlConnection.ConnectionString property

Monday, March 12, 2012

How to create a new schema

How can I create a new schema inside a database from Managment studio express.

Also can someone explain me the concept of schema clearly. If database is like a house, then is schema like a room in it ?

if you use the metaphor House, you could say that the house is the database, the appartments are the schemas, though they can be owned by someone on have kinds of objects in them (tables, views --> rooms). If the owner of the appartment or the actual person who rent the appartment wants to quit the contract, you will first have to find another owner / contract partner vefore moving out of the appartment.

http://msdn2.microsoft.com/en-us/library/ms190387.aspx

Jens K. Suessmeyer.

http://www.sqlserver2005.de
|||

Thanks. Have another question. When we create a new schema is some part of database memory allocated to it and hence having too many schemas... leads to memory fragmentation problems and hence not efficient ?

Wednesday, March 7, 2012

How to count the tasks inside a package programmatically?

Hi there,

I'm trying to keep track of the ETL process inserting/updating a row in one table for each package that finish in my ETL process when executing. So far, I created a Script task that increments by one a variable (counter) and then open a connection to my database an insert/update my table. What I want to see is Step 1/30, Step 2/30 and so on. Right know I can display Step 1, Step 2 but how can I get the overall number of tasks within a package?

Thanks in advance for any help you can give me.

Sincerely,
Ricardo

A script task cannot interrogate the package in which it resides to find out that information. Unlike in DTS, tasks do not receive a pointer to package itself. So you can't do what you used to do in DTS i.e. Get a reference to DTSGlobalVariables.Parent and iterate over the object model.

This is one of the big differences in SSIS.

Some extra reading:

But it used to work in DTS (1) - Modifing a Package in script

(http://blogs.conchango.com/jamiethomson/archive/2006/06/28/SSIS_3A00_-But-it-used-to-work-in-DTS-_2800_1_2900_-_2D00_-Modifing-a-Package-in-script.aspx)

-Jamie

|||

You could handle the counting yourself - store one variable with the total count of steps, and another variable that you increment with script tasks as the package executes.

It's a little more work, but it should accomplish what you want.

|||

jwelch wrote:

You could handle the counting yourself - store one variable with the total count of steps, and another variable that you increment with script tasks as the package executes.

It's a little more work, but it should accomplish what you want.

Good idea. Thought you'll probably want to put the script task that increments the value into the OnPostExecute eventhandler scoped to the package.

-Jamie

|||Well, to get the count what I ended up doing is to call the package itself from a Script Task so I can do package.Executables.Count in order to get the total number of tasks inside a package.

I still used the Post-Execute event to increment my counter and to insert/update a row in my audit table.

Thank you guys for the suggestions.

Ricardo|||

bachocha wrote:

Well, to get the count what I ended up doing is to call the package itself from a Script Task so I can do package.Executables.Count in order to get the total number of tasks inside a package.

I still used the Post-Execute event to increment my counter and to insert/update a row in my audit table.

Thank you guys for the suggestions.

Ricardo

So you're building a package solely for the purpose of calling another package? You could of course write a .Net app to do this for you - I find it interesting that you chose not to and instead use SSIS itself as the host for your .Net code.

Anyway...I'm waffling. Glad you got what you wanted.

-Jamie

|||Actually, I think he's calling a new instance of the package from inside the same package. Seems like a lot of overhead, but to each his own.|||Yes, John is right. I'm loading the same package from inside my package using a Script Task. I was thinking to create a new package which only loads the package I want to get the number of tasks and then store this count into a variable.

I don't think I could use a .NET app, I mean I can build it but probably I will not be able to deploy it in production. I can only move dtsx packages. I really would like to implement the best solution for this problem. So if you think that loading the same pacakge from itself is an overhead, what would be the right way?

Thanks!

Ricardo|||

bachocha wrote:

Yes, John is right. I'm loading the same package from inside my package using a Script Task. I was thinking to create a new package which only loads the package I want to get the number of tasks and then store this count into a variable.

I don't think I could use a .NET app, I mean I can build it but probably I will not be able to deploy it in production. I can only move dtsx packages. I really would like to implement the best solution for this problem. So if you think that loading the same pacakge from itself is an overhead, what would be the right way?

Thanks!

Ricardo

Its not an overhead if it doesn't cause any problems. It seems like a strange thing to do but if it works for you - go for it.

-Jamie

|||

bachocha wrote:

So if you think that loading the same pacakge from itself is an overhead, what would be the right way?

"Right way" - I don't know. My comment about overhead was that you are essentially loading the package twice - once to do the real work, once to count the executables. Not a big deal if you are doing it in one or two packages. Across a few dozen, it might have more impact. However, just loading the package doesn't have the same overhead as executing it, so maybe it's not a problem. Like Jamie said, if it works for you, go with it.