Showing posts with label generate. Show all posts
Showing posts with label generate. Show all posts

Tuesday, March 20, 2012

case expression plus outer join in ole db source

I'm trying to generate the data for a 2-column table, where both columns are defined as NOT NULL and the second column is a uniqueidentifier.

In SQL Server Management Studio, this works fine:

insert into table_3(column_a, column_b)

select table_1.column_a, (case when table_2.column_b is NULL then newid() else table_2.column_b end) as column_b

from table_1 left outer join table_2 on table_1.column_c = table_2.column_c

That is, column_b of the SELECT result has no NULL values, and all 35,986 rows are successfully inserted into a previously empty table_3. (If I comment out the INSERT INTO clause and project table_2.column_b instead of "(case ... end) as column_b", the SELECT result includes 380 rows with a NULL in column_b, so I know the case expression plus the outer join are working as expected.)

But when I use the SELECT query as the SQL command in an OLE DB Source component that is connected directly to the OLE DB Destination for the result table, I get this error:

There was an error with input column "column_b" (445) on input "OLE DB Destination Input" (420

The column status returned was: "The value violated the integrity constraints for the column.".

And sure enough, when I modify the result table to allow NULL in column_b, truncate it, and re-run the data flow, it inserts the exact same 380 rows with a NULL in column_b among the 35,986 rows.

So what is SSIS doing to screw up the results of the SELECT command?

Kevin,

Can you see the values of column_b when you use the 'preview' of the OLE DB source?

Did you check twice the mapping tab in your OLE DB destination to make sure nothing is missing?

Have you used a data view right before the OLE DB Destination to check the values of column_b are shown correctly?

If the answer to those 3 questions is yes, I am affraid I could not help you.

Rafael Salas

|||Could there be an issue in executing the newid() function?|||

Argh, the problem was due to operator error: somehow the source component SQL statement had gotten out of sync with the corresponding variable. How embarrassing!

But many thanks to Rafael and Phil, who got me to examine the data flow task closely enough to discover my error.

Saturday, February 25, 2012

Capturing stored proc names in profiler

Hello,
I was wondering if anyone had some insight into my problem.
I'm running a trace and I want to generate a report to show some simple
statistics about the duration, reads, and writes for the stored procedures
in my database. I'm having trouble parsing the stored procedure name from
the TextData field. The RPC:Completed event gives me everything I need for
the statistics, but it doesn't give me the stored procedure name or object
id. I does, however, give me full command, but I have to parse this with
string manipulation which is not quick. The SP:Completed event gives me the
object id of the stored procedure, but non of the statistics. My trace
files are very large and I'm looking for an easy way to generate some
statistics.
Thanks!
Hi
I assume that you are loading these into a table for analysis, therefore if
you create a new column for the procedure name (and the procedures have a
recognisable prefix e.g 'prc_ ' in the first 8000 characters of the
textdate, then you can use substring and charindex to update the new column.
When you select the data from the table you can restrict the events
returned.
John
"Oliwa" <abc> wrote in message
news:%23qbnElyJFHA.2576@.TK2MSFTNGP15.phx.gbl...
> Hello,
> I was wondering if anyone had some insight into my problem.
> I'm running a trace and I want to generate a report to show some simple
> statistics about the duration, reads, and writes for the stored procedures
> in my database. I'm having trouble parsing the stored procedure name from
> the TextData field. The RPC:Completed event gives me everything I need
> for the statistics, but it doesn't give me the stored procedure name or
> object id. I does, however, give me full command, but I have to parse
> this with string manipulation which is not quick. The SP:Completed event
> gives me the object id of the stored procedure, but non of the statistics.
> My trace files are very large and I'm looking for an easy way to generate
> some statistics.
> Thanks!
>
|||Hey John,
That's an idea, but I'm doing something very similar with string
manipulation. I was looking for methods that didn't require string
manipulation.
Thanks
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:%23rCtG6zJFHA.3336@.TK2MSFTNGP09.phx.gbl...
> Hi
> I assume that you are loading these into a table for analysis, therefore
> if you create a new column for the procedure name (and the procedures have
> a recognisable prefix e.g 'prc_ ' in the first 8000 characters of the
> textdate, then you can use substring and charindex to update the new
> column.
> When you select the data from the table you can restrict the events
> returned.
> John
>
> "Oliwa" <abc> wrote in message
> news:%23qbnElyJFHA.2576@.TK2MSFTNGP15.phx.gbl...
>
|||Hi
If you are only profiling a single user then you can always check your
object ID from the previous SP:Completed event. Even if not a single user,
then you should be able to match SIDs.
When moving the profile into a table, Profiler will generate a RowNumber
Identity column for you.
John
"Oliwa" <abc> wrote in message news:OGJDUB0JFHA.2648@.TK2MSFTNGP14.phx.gbl...
> Hey John,
> That's an idea, but I'm doing something very similar with string
> manipulation. I was looking for methods that didn't require string
> manipulation.
> Thanks
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:%23rCtG6zJFHA.3336@.TK2MSFTNGP09.phx.gbl...
>

Capturing stored proc names in profiler

Hello,
I was wondering if anyone had some insight into my problem.
I'm running a trace and I want to generate a report to show some simple
statistics about the duration, reads, and writes for the stored procedures
in my database. I'm having trouble parsing the stored procedure name from
the TextData field. The RPC:Completed event gives me everything I need for
the statistics, but it doesn't give me the stored procedure name or object
id. I does, however, give me full command, but I have to parse this with
string manipulation which is not quick. The SP:Completed event gives me the
object id of the stored procedure, but non of the statistics. My trace
files are very large and I'm looking for an easy way to generate some
statistics.
Thanks!Hi
I assume that you are loading these into a table for analysis, therefore if
you create a new column for the procedure name (and the procedures have a
recognisable prefix e.g 'prc_ ' in the first 8000 characters of the
textdate, then you can use substring and charindex to update the new column.
When you select the data from the table you can restrict the events
returned.
John
"Oliwa" <abc> wrote in message
news:%23qbnElyJFHA.2576@.TK2MSFTNGP15.phx.gbl...
> Hello,
> I was wondering if anyone had some insight into my problem.
> I'm running a trace and I want to generate a report to show some simple
> statistics about the duration, reads, and writes for the stored procedures
> in my database. I'm having trouble parsing the stored procedure name from
> the TextData field. The RPC:Completed event gives me everything I need
> for the statistics, but it doesn't give me the stored procedure name or
> object id. I does, however, give me full command, but I have to parse
> this with string manipulation which is not quick. The SP:Completed event
> gives me the object id of the stored procedure, but non of the statistics.
> My trace files are very large and I'm looking for an easy way to generate
> some statistics.
> Thanks!
>|||Hey John,
That's an idea, but I'm doing something very similar with string
manipulation. I was looking for methods that didn't require string
manipulation.
Thanks
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:%23rCtG6zJFHA.3336@.TK2MSFTNGP09.phx.gbl...
> Hi
> I assume that you are loading these into a table for analysis, therefore
> if you create a new column for the procedure name (and the procedures have
> a recognisable prefix e.g 'prc_ ' in the first 8000 characters of the
> textdate, then you can use substring and charindex to update the new
> column.
> When you select the data from the table you can restrict the events
> returned.
> John
>
> "Oliwa" <abc> wrote in message
> news:%23qbnElyJFHA.2576@.TK2MSFTNGP15.phx.gbl...
>|||Hi
If you are only profiling a single user then you can always check your
object ID from the previous SP:Completed event. Even if not a single user,
then you should be able to match SIDs.
When moving the profile into a table, Profiler will generate a RowNumber
Identity column for you.
John
"Oliwa" <abc> wrote in message news:OGJDUB0JFHA.2648@.TK2MSFTNGP14.phx.gbl...
> Hey John,
> That's an idea, but I'm doing something very similar with string
> manipulation. I was looking for methods that didn't require string
> manipulation.
> Thanks
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:%23rCtG6zJFHA.3336@.TK2MSFTNGP09.phx.gbl...
>

Capturing stored proc names in profiler

Hello,
I was wondering if anyone had some insight into my problem.
I'm running a trace and I want to generate a report to show some simple
statistics about the duration, reads, and writes for the stored procedures
in my database. I'm having trouble parsing the stored procedure name from
the TextData field. The RPC:Completed event gives me everything I need for
the statistics, but it doesn't give me the stored procedure name or object
id. I does, however, give me full command, but I have to parse this with
string manipulation which is not quick. The SP:Completed event gives me the
object id of the stored procedure, but non of the statistics. My trace
files are very large and I'm looking for an easy way to generate some
statistics.
Thanks!
Hi
I assume that you are loading these into a table for analysis, therefore if
you create a new column for the procedure name (and the procedures have a
recognisable prefix e.g 'prc_ ' in the first 8000 characters of the
textdate, then you can use substring and charindex to update the new column.
When you select the data from the table you can restrict the events
returned.
John
"Oliwa" <abc> wrote in message
news:%23qbnElyJFHA.2576@.TK2MSFTNGP15.phx.gbl...
> Hello,
> I was wondering if anyone had some insight into my problem.
> I'm running a trace and I want to generate a report to show some simple
> statistics about the duration, reads, and writes for the stored procedures
> in my database. I'm having trouble parsing the stored procedure name from
> the TextData field. The RPC:Completed event gives me everything I need
> for the statistics, but it doesn't give me the stored procedure name or
> object id. I does, however, give me full command, but I have to parse
> this with string manipulation which is not quick. The SP:Completed event
> gives me the object id of the stored procedure, but non of the statistics.
> My trace files are very large and I'm looking for an easy way to generate
> some statistics.
> Thanks!
>
|||Hey John,
That's an idea, but I'm doing something very similar with string
manipulation. I was looking for methods that didn't require string
manipulation.
Thanks
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:%23rCtG6zJFHA.3336@.TK2MSFTNGP09.phx.gbl...
> Hi
> I assume that you are loading these into a table for analysis, therefore
> if you create a new column for the procedure name (and the procedures have
> a recognisable prefix e.g 'prc_ ' in the first 8000 characters of the
> textdate, then you can use substring and charindex to update the new
> column.
> When you select the data from the table you can restrict the events
> returned.
> John
>
> "Oliwa" <abc> wrote in message
> news:%23qbnElyJFHA.2576@.TK2MSFTNGP15.phx.gbl...
>
|||Hi
If you are only profiling a single user then you can always check your
object ID from the previous SP:Completed event. Even if not a single user,
then you should be able to match SIDs.
When moving the profile into a table, Profiler will generate a RowNumber
Identity column for you.
John
"Oliwa" <abc> wrote in message news:OGJDUB0JFHA.2648@.TK2MSFTNGP14.phx.gbl...
> Hey John,
> That's an idea, but I'm doing something very similar with string
> manipulation. I was looking for methods that didn't require string
> manipulation.
> Thanks
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:%23rCtG6zJFHA.3336@.TK2MSFTNGP09.phx.gbl...
>

Capturing stored proc names in profiler

Hello,
I was wondering if anyone had some insight into my problem.
I'm running a trace and I want to generate a report to show some simple
statistics about the duration, reads, and writes for the stored procedures
in my database. I'm having trouble parsing the stored procedure name from
the TextData field. The RPC:Completed event gives me everything I need for
the statistics, but it doesn't give me the stored procedure name or object
id. I does, however, give me full command, but I have to parse this with
string manipulation which is not quick. The SP:Completed event gives me the
object id of the stored procedure, but non of the statistics. My trace
files are very large and I'm looking for an easy way to generate some
statistics.
Thanks!Hi
I assume that you are loading these into a table for analysis, therefore if
you create a new column for the procedure name (and the procedures have a
recognisable prefix e.g 'prc_ ' in the first 8000 characters of the
textdate, then you can use substring and charindex to update the new column.
When you select the data from the table you can restrict the events
returned.
John
"Oliwa" <abc> wrote in message
news:%23qbnElyJFHA.2576@.TK2MSFTNGP15.phx.gbl...
> Hello,
> I was wondering if anyone had some insight into my problem.
> I'm running a trace and I want to generate a report to show some simple
> statistics about the duration, reads, and writes for the stored procedures
> in my database. I'm having trouble parsing the stored procedure name from
> the TextData field. The RPC:Completed event gives me everything I need
> for the statistics, but it doesn't give me the stored procedure name or
> object id. I does, however, give me full command, but I have to parse
> this with string manipulation which is not quick. The SP:Completed event
> gives me the object id of the stored procedure, but non of the statistics.
> My trace files are very large and I'm looking for an easy way to generate
> some statistics.
> Thanks!
>|||Hey John,
That's an idea, but I'm doing something very similar with string
manipulation. I was looking for methods that didn't require string
manipulation.
Thanks
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:%23rCtG6zJFHA.3336@.TK2MSFTNGP09.phx.gbl...
> Hi
> I assume that you are loading these into a table for analysis, therefore
> if you create a new column for the procedure name (and the procedures have
> a recognisable prefix e.g 'prc_ ' in the first 8000 characters of the
> textdate, then you can use substring and charindex to update the new
> column.
> When you select the data from the table you can restrict the events
> returned.
> John
>
> "Oliwa" <abc> wrote in message
> news:%23qbnElyJFHA.2576@.TK2MSFTNGP15.phx.gbl...
>|||Hi
If you are only profiling a single user then you can always check your
object ID from the previous SP:Completed event. Even if not a single user,
then you should be able to match SIDs.
When moving the profile into a table, Profiler will generate a RowNumber
Identity column for you.
John
"Oliwa" <abc> wrote in message news:OGJDUB0JFHA.2648@.TK2MSFTNGP14.phx.gbl...
> Hey John,
> That's an idea, but I'm doing something very similar with string
> manipulation. I was looking for methods that didn't require string
> manipulation.
> Thanks
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:%23rCtG6zJFHA.3336@.TK2MSFTNGP09.phx.gbl...
>

Capturing stored proc names in profiler

Hello,
I was wondering if anyone had some insight into my problem.
I'm running a trace and I want to generate a report to show some simple
statistics about the duration, reads, and writes for the stored procedures
in my database. I'm having trouble parsing the stored procedure name from
the TextData field. The RPC:Completed event gives me everything I need for
the statistics, but it doesn't give me the stored procedure name or object
id. I does, however, give me full command, but I have to parse this with
string manipulation which is not quick. The SP:Completed event gives me the
object id of the stored procedure, but non of the statistics. My trace
files are very large and I'm looking for an easy way to generate some
statistics.
Thanks!Hi
I assume that you are loading these into a table for analysis, therefore if
you create a new column for the procedure name (and the procedures have a
recognisable prefix e.g 'prc_ ' in the first 8000 characters of the
textdate, then you can use substring and charindex to update the new column.
When you select the data from the table you can restrict the events
returned.
John
"Oliwa" <abc> wrote in message
news:%23qbnElyJFHA.2576@.TK2MSFTNGP15.phx.gbl...
> Hello,
> I was wondering if anyone had some insight into my problem.
> I'm running a trace and I want to generate a report to show some simple
> statistics about the duration, reads, and writes for the stored procedures
> in my database. I'm having trouble parsing the stored procedure name from
> the TextData field. The RPC:Completed event gives me everything I need
> for the statistics, but it doesn't give me the stored procedure name or
> object id. I does, however, give me full command, but I have to parse
> this with string manipulation which is not quick. The SP:Completed event
> gives me the object id of the stored procedure, but non of the statistics.
> My trace files are very large and I'm looking for an easy way to generate
> some statistics.
> Thanks!
>|||Hey John,
That's an idea, but I'm doing something very similar with string
manipulation. I was looking for methods that didn't require string
manipulation.
Thanks
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:%23rCtG6zJFHA.3336@.TK2MSFTNGP09.phx.gbl...
> Hi
> I assume that you are loading these into a table for analysis, therefore
> if you create a new column for the procedure name (and the procedures have
> a recognisable prefix e.g 'prc_ ' in the first 8000 characters of the
> textdate, then you can use substring and charindex to update the new
> column.
> When you select the data from the table you can restrict the events
> returned.
> John
>
> "Oliwa" <abc> wrote in message
> news:%23qbnElyJFHA.2576@.TK2MSFTNGP15.phx.gbl...
>> Hello,
>> I was wondering if anyone had some insight into my problem.
>> I'm running a trace and I want to generate a report to show some simple
>> statistics about the duration, reads, and writes for the stored
>> procedures in my database. I'm having trouble parsing the stored
>> procedure name from the TextData field. The RPC:Completed event gives me
>> everything I need for the statistics, but it doesn't give me the stored
>> procedure name or object id. I does, however, give me full command, but
>> I have to parse this with string manipulation which is not quick. The
>> SP:Completed event gives me the object id of the stored procedure, but
>> non of the statistics. My trace files are very large and I'm looking for
>> an easy way to generate some statistics.
>> Thanks!
>|||Hi
If you are only profiling a single user then you can always check your
object ID from the previous SP:Completed event. Even if not a single user,
then you should be able to match SIDs.
When moving the profile into a table, Profiler will generate a RowNumber
Identity column for you.
John
"Oliwa" <abc> wrote in message news:OGJDUB0JFHA.2648@.TK2MSFTNGP14.phx.gbl...
> Hey John,
> That's an idea, but I'm doing something very similar with string
> manipulation. I was looking for methods that didn't require string
> manipulation.
> Thanks
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:%23rCtG6zJFHA.3336@.TK2MSFTNGP09.phx.gbl...
>> Hi
>> I assume that you are loading these into a table for analysis, therefore
>> if you create a new column for the procedure name (and the procedures
>> have a recognisable prefix e.g 'prc_ ' in the first 8000 characters of
>> the textdate, then you can use substring and charindex to update the new
>> column.
>> When you select the data from the table you can restrict the events
>> returned.
>> John
>>
>> "Oliwa" <abc> wrote in message
>> news:%23qbnElyJFHA.2576@.TK2MSFTNGP15.phx.gbl...
>> Hello,
>> I was wondering if anyone had some insight into my problem.
>> I'm running a trace and I want to generate a report to show some simple
>> statistics about the duration, reads, and writes for the stored
>> procedures in my database. I'm having trouble parsing the stored
>> procedure name from the TextData field. The RPC:Completed event gives
>> me everything I need for the statistics, but it doesn't give me the
>> stored procedure name or object id. I does, however, give me full
>> command, but I have to parse this with string manipulation which is not
>> quick. The SP:Completed event gives me the object id of the stored
>> procedure, but non of the statistics. My trace files are very large and
>> I'm looking for an easy way to generate some statistics.
>> Thanks!
>>
>

Tuesday, February 14, 2012

Can't use SQL Express in VS2005

When I try to add a new database to App_Data in a VS2005sp1 project I get "Failed to generate a user instance of SQL Server due to a failure in starting the process for the user interface".

I have SQL2005sp2 and SQL Express on the system, both services are running, and an instance of the latter called SQLExpress which I can use through SQL Server Management Studio. sp_configure user instances enabled is set to 1. The SQL Server Instance Name in Options | Database Tools | Data Connections is set to SQLExpress ...

I have no idea how to proceed .. any ideas anyone?

Thanks

John

Most causes of this error are solved by deleting the folder where we store the SQL Express User Instance system files, which is C:\Documents and Settings\<username>\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS. You may need to reboot your computer after this, so just eliminate any concerns and reboot.

The once cause that this will not resolve is if you are working thorugh remote desktop. There is bug in windows that results in the remote login not have certain permissions. The problem is explained in http://support.microsoft.com/Default.aspx?id=896613 and you will need to call Microsoft Support to obtain the Hotfix for the problem.

Hopefully this helps.

Mike

|||

Thanks, Mike

That was it. Problem now solved.

John

|||I had the following trouble.
- Installed MSSQLEXPRESS
- Installed Visual Studio 2005
- Uninstalled MSSQLEXPRESS
- Installed MSSQLEXPRESS

->the bloody error started appearing.

The suggested method worked perfectly!!
I killed the folder, restarted Studio, now can connect to the databases.

Cheers,
Valekm