Showing posts with label sp2. Show all posts
Showing posts with label sp2. Show all posts

Tuesday, March 27, 2012

Dropping an old foreign key restraint?

This forum looked like the only one where I may get an answer to this question.

I built a database with a set of tables in Sql Server 2005 sp2.

I later had to refactor the data which led to removing one table, renaming another table, and moving some data around.

Now when I attempt to write my test code and execute my initialization logic (which clears data out of the tables) I get a foreign key restraint error when trying to delete one of my records. However the FK restraint is an old one that refers to a table that no longer exists. I have looked at all of my tables in the current design and the constraint referenced in the exception does not show up on any of the tables.

How things changed: I had DesktopItems tie to a DataEntry table with a foreign key constraint. I now have DesktopItems point to WorkItem ( the orgininal table renamed ) and it is on the delete of items from DesktopItems that I get the old FK constraint. The really odd part about this is if I go into the table and manually delete the record, I do NOT get the constraint error!!!

In the database that I'm getting the error, I implemented the changes by deleting all tables and SPROCS and then executing scripts to rebuild the new design.

Is there a system SPROC that I can execute to show and delete this item?

Dear Michael,

Try this code:

IF EXISTS (SELECT * from sysconstraints WHERE constid = OBJECT_ID (N'[FK_DesktopItems_TO_DataEntry]'))
IF OBJECT_ID (N'[DesktopItems]') IS NOT NULL
EXEC ('ALTER TABLE [DesktopItems] DROP CONSTRAINT FK_DesktopItems_TO_DataEntry')

HTH,

Suprotim Agarwal

Dropping an old foreign key restraint?

This forum looked like the only one where I may get an answer to this question.

I built a database with a set of tables in Sql Server 2005 sp2.

I later had to refactor the data which led to removing one table, renaming another table, and moving some data around.

Now when I attempt to write my test code and execute my initialization logic (which clears data out of the tables) I get a foreign key restraint error when trying to delete one of my records. However the FK restraint is an old one that refers to a table that no longer exists. I have looked at all of my tables in the current design and the constraint referenced in the exception does not show up on any of the tables.

How things changed: I had DesktopItems tie to a DataEntry table with a foreign key constraint. I now have DesktopItems point to WorkItem ( the orgininal table renamed ) and it is on the delete of items from DesktopItems that I get the old FK constraint. The really odd part about this is if I go into the table and manually delete the record, I do NOT get the constraint error!!!

In the database that I'm getting the error, I implemented the changes by deleting all tables and SPROCS and then executing scripts to rebuild the new design.

Is there a system SPROC that I can execute to show and delete this item?

Dear Michael,

Try this code:

IF EXISTS (SELECT * from sysconstraints WHERE constid = OBJECT_ID (N'[FK_DesktopItems_TO_DataEntry]'))
IF OBJECT_ID (N'[DesktopItems]') IS NOT NULL
EXEC ('ALTER TABLE [DesktopItems] DROP CONSTRAINT FK_DesktopItems_TO_DataEntry')

HTH,

Suprotim Agarwal

Thursday, March 22, 2012

Dropdown list width

Hi everybody,

I created a multivalue parameter in SSRS 2005 SP2, but the problem is that the width of the dropdown list is too small to fit my data (I'd like to avoid scrolling horizontally).

Is there any way to configure this?

Thanks in advance for your help.
Zoz

By converting the display parameter to a char value using convert(char(50),myvalue) as displayparam you should be able to make the field fixed width.

If you want to shrink the size of the box, you would need to limit the display output by using the substring function.

cheers,

Andrew

|||

Thanks for your answer Andrew.

Unfortunately, it doesn't work... I still need to scroll horizontally even when converting data to char...

May be there is some way to specify the width of the drop down list, but I have no idea where I could do that...

|||

there is a way to do this

-open up the dataset (assuming there is one) that returns values to your report params by clicking the ...

-now select the fields tab

-next edit the value column(by using an expression) for the field that is being displayed for your report parameter. you should be able to set a specified length of characters that you would like. this in turn will limit the width of the report parameter

sql

Monday, March 19, 2012

Drop replication question

Using SQL2005 SP2 transactional replication. Whenever we have a deploy to
production that contains DDL, I drop the publication and then drop the
subscription on the replicated server. Once the update is complete, I
recreate the publication with any changes that are necessary and then
re-create the subscription, and then the snapshot agent runs. Is that what
most people do?
This works fine, but I feel it is overkill. Is there a simpler way to
temporarily disable the replication until the DDL changes are made without
dropping and recreating the publication and subscription?
Is there any negative impact by my dropping and recreating the publication
and subscription.
Thanks
Ron
Many schema changes will be automatically replicated is the replicate_ddl
parameter is set to true for sp_addpublication and sp_addmergepublication.
There are some which you will have to do the drop subscriptions and drop
publications, for example changes to pk, adding defaults, identities, etc.
The problem with your approach is that there is add overhead and your
subscriber tables have to be recreated each time.
http://www.zetainteractive.com - Shift Happens!
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Ron" <Ron@.discussions.microsoft.com> wrote in message
news:A7ED2B66-F49D-4FD3-AD22-54CD8A54DAB9@.microsoft.com...
> Using SQL2005 SP2 transactional replication. Whenever we have a deploy to
> production that contains DDL, I drop the publication and then drop the
> subscription on the replicated server. Once the update is complete, I
> recreate the publication with any changes that are necessary and then
> re-create the subscription, and then the snapshot agent runs. Is that
> what
> most people do?
> This works fine, but I feel it is overkill. Is there a simpler way to
> temporarily disable the replication until the DDL changes are made without
> dropping and recreating the publication and subscription?
> Is there any negative impact by my dropping and recreating the publication
> and subscription.
> Thanks
> Ron
|||Just so I'm clear, I think what you're saying is that there isn't any
intermediate step such as disable or turn off replication temporarily, you
would need to drop subscription and publication.
We do have "replicate Schema Changes" = TRUE, however one of our deploy code
failed due to replication being active. I guess since not knowing exactly
what can and can't be replicated, it wouldn't hurt to simply drop publication
and subscription, perform the changes and then add the publication and
subscription back again. Since a deploy is done after hours and replication
currently only takes about 15 minutes to add publication and subscription as
well as run the snapshot agent, it sounds like it's the safest way to go as
the time it takes to recreate the publication and subscription isn't an issue
to us.
Thanks.
"Hilary Cotter" wrote:

> Many schema changes will be automatically replicated is the replicate_ddl
> parameter is set to true for sp_addpublication and sp_addmergepublication.
> There are some which you will have to do the drop subscriptions and drop
> publications, for example changes to pk, adding defaults, identities, etc.
> The problem with your approach is that there is add overhead and your
> subscriber tables have to be recreated each time.
> --
> http://www.zetainteractive.com - Shift Happens!
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
> "Ron" <Ron@.discussions.microsoft.com> wrote in message
> news:A7ED2B66-F49D-4FD3-AD22-54CD8A54DAB9@.microsoft.com...
>
>
|||Exactly, there is no step that makes replication disabled.
There are some schema changes which are not replicated as you have found
out. I would probably try the deploy code out in a test environment to find
out what breaks and then remove those articles from the publication, make
the change and then add them back in.
http://www.zetainteractive.com - Shift Happens!
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Ron" <Ron@.discussions.microsoft.com> wrote in message
news:57CDE6A7-E4C1-45D7-8F1F-02BCD8A763C6@.microsoft.com...[vbcol=seagreen]
> Just so I'm clear, I think what you're saying is that there isn't any
> intermediate step such as disable or turn off replication temporarily, you
> would need to drop subscription and publication.
> We do have "replicate Schema Changes" = TRUE, however one of our deploy
> code
> failed due to replication being active. I guess since not knowing exactly
> what can and can't be replicated, it wouldn't hurt to simply drop
> publication
> and subscription, perform the changes and then add the publication and
> subscription back again. Since a deploy is done after hours and
> replication
> currently only takes about 15 minutes to add publication and subscription
> as
> well as run the snapshot agent, it sounds like it's the safest way to go
> as
> the time it takes to recreate the publication and subscription isn't an
> issue
> to us.
> Thanks.
> "Hilary Cotter" wrote:
|||Thanks for your help and clarification.
"Hilary Cotter" wrote:

> Exactly, there is no step that makes replication disabled.
> There are some schema changes which are not replicated as you have found
> out. I would probably try the deploy code out in a test environment to find
> out what breaks and then remove those articles from the publication, make
> the change and then add them back in.
> --
> http://www.zetainteractive.com - Shift Happens!
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
> "Ron" <Ron@.discussions.microsoft.com> wrote in message
> news:57CDE6A7-E4C1-45D7-8F1F-02BCD8A763C6@.microsoft.com...
>
>

Sunday, March 11, 2012

Drop Down list with many elements

Hello,

I am using SSRS 2005 SP2 and I need to allow my users to select the products they want in the report.
I created a data set to get the list of the products and then used it in a multivalue parameter to generate a drop down list.
My problem is that the list is too long (more than 2000 elements) and thus, it takes 10 sec to collapse the drop down list after tickinging the products.

Does anyone have an miraculous solution?
Thanks in advance for your answers.

Zoz

Did you create the drop down list using visual studio 2005?

You may want to divide this HUGE dropdownlist into maybe 26 dropdown lists -- categorize them by first letter in the product.

Only populate the A dropdown list with products that start with A, etc.

Then, handle each dropdown list's selection changed event separately. (I would imagine that each event would have the same code though)

Or maybe 26 is too many. Just do one dropdown for the first half of the alphabet and then another for the second half.

You get the idea though: divide and conquer.

|||I like the idea of conquering :-)
Your idea is good but I alreday have many drop down lists because I use cascading parameters (8!). Then it would become too heavy visually...

Any other solution?
Thanks.

PS: Yes, I used Visual Studio 2005.
|||

You can have a muti-page report.

The idea is to create a parameter called "Search Product" which takes string as an argument.

Then output products based on the value of the parameter.

Then click on the product which will take you to your current report.

Thanks,

-Rohit

|||Hi,

Can you detail a little bit more? I am not sure to understand what you mean...
Do you mean that I should create a search field?

Thanks.
Zoz
|||

See what I am trying to say is:

1. Create a summary page where you have a parameter which will search for productName (say we call it @.searchProduct) and generate a list of products related to that name. In SQL you can do (where productName like '% + @.searchProduct + %')

2. Then if the user click on a product it will take you to another report where you have all other parameters.

But the good thing is you don't have to worry about the product because you already selected your product and passed the productID from report1 to report2. Report2 is basically the same report you are working on but without the parameter for productID. You can make it hidden.

Feel free to ask me more questions...

|||

I really like your idea and I'm very curious to see how to implement it. Would you mind sending me an example by email (an rdl file for example)? I' ve tried something like that in the past, but I've never succeeded to do it... :-(

For the problem I popsted previously, your solution doesn't meet the requirements because users need to choose several products...

I tried to implement cascading parameters although it is not the best one in terms of performance... So I'm still looking for a better idea.

Thanks

|||

It is very simple....

For exmple if you are using table to output the products then right click on the detail textbox and go to properties and then click on navigation. There you can select jump to a report, select the report you want to jump to and pass productId as a parameter. Now when you run the report you will be able to click on the products and it will take you to the next report that you specified in the properties.

-Rohit

|||

Thanks for your answer! Looks like it is a great idea! I'll try it!

And is there any way to have a "select all" ? ( it is also requiered by my users...)

Thanks

Zoz

Drop Down list with many elements

Hello,

I am using SSRS 2005 SP2 and I need to allow my users to select the products they want in the report.
I created a data set to get the list of the products and then used it in a multivalue parameter to generate a drop down list.
My problem is that the list is too long (more than 2000 elements) and thus, it takes 10 sec to collapse the drop down list after tickinging the products.

Does anyone have an miraculous solution?
Thanks in advance for your answers.

Zoz

Did you create the drop down list using visual studio 2005?

You may want to divide this HUGE dropdownlist into maybe 26 dropdown lists -- categorize them by first letter in the product.

Only populate the A dropdown list with products that start with A, etc.

Then, handle each dropdown list's selection changed event separately. (I would imagine that each event would have the same code though)

Or maybe 26 is too many. Just do one dropdown for the first half of the alphabet and then another for the second half.

You get the idea though: divide and conquer.

|||I like the idea of conquering :-)
Your idea is good but I alreday have many drop down lists because I use cascading parameters (8!). Then it would become too heavy visually...

Any other solution?
Thanks.

PS: Yes, I used Visual Studio 2005.
|||

You can have a muti-page report.

The idea is to create a parameter called "Search Product" which takes string as an argument.

Then output products based on the value of the parameter.

Then click on the product which will take you to your current report.

Thanks,

-Rohit

|||Hi,

Can you detail a little bit more? I am not sure to understand what you mean...
Do you mean that I should create a search field?

Thanks.
Zoz
|||

See what I am trying to say is:

1. Create a summary page where you have a parameter which will search for productName (say we call it @.searchProduct) and generate a list of products related to that name. In SQL you can do (where productName like '% + @.searchProduct + %')

2. Then if the user click on a product it will take you to another report where you have all other parameters.

But the good thing is you don't have to worry about the product because you already selected your product and passed the productID from report1 to report2. Report2 is basically the same report you are working on but without the parameter for productID. You can make it hidden.

Feel free to ask me more questions...

|||

I really like your idea and I'm very curious to see how to implement it. Would you mind sending me an example by email (an rdl file for example)? I' ve tried something like that in the past, but I've never succeeded to do it... :-(

For the problem I popsted previously, your solution doesn't meet the requirements because users need to choose several products...

I tried to implement cascading parameters although it is not the best one in terms of performance... So I'm still looking for a better idea.

Thanks

|||

It is very simple....

For exmple if you are using table to output the products then right click on the detail textbox and go to properties and then click on navigation. There you can select jump to a report, select the report you want to jump to and pass productId as a parameter. Now when you run the report you will be able to click on the products and it will take you to the next report that you specified in the properties.

-Rohit

|||

Thanks for your answer! Looks like it is a great idea! I'll try it!

And is there any way to have a "select all" ? ( it is also requiered by my users...)

Thanks

Zoz

Sunday, February 26, 2012

driver's sqlallochandle on sql_handle_env failed

i have just installed sql clinet
(Microsoft SQL Enterprise Manager Microsoft Corporation Version: 8.0)
on windows XP sp2 . whenever i try to reg new sql servers through Enterprise
Mgr it gives me this error . it looks like its associated with ODBC . need to
figure out whats the problem
Thanks & Regards
Sid
Try applying SQL Server 2000 SP4 + Cumulative Hotfix Build 2187.
http://www.microsoft.com/downloads/details.aspx?FamilyID=8e2dfc8d-c20e-4446-99a9-b7f0213f8bc5&DisplayLang=en
http://www.microsoft.com/downloads/details.aspx?FamilyID=9c9ab140-bdee-44df-b7a3-e6849297754a&displaylang=en
http://www.microsoft.com/downloads/details.aspx?FamilyID=1705bd2f-1fb8-4ec8-b3db-0935361308c7&displaylang=en
http://www.microsoft.com/downloads/details.aspx?familyid=A643980A-26A4-44C1-9B50-53E20E7210B5&displaylang=en
http://www.microsoft.com/downloads/details.aspx?FamilyId=243A8A89-74D6-48FD-933F-32FF9D8459C2&displaylang=en
http://www.microsoft.com/downloads/details.aspx?FamilyId=2BB62F35-D041-42AC-98DA-6EC97168BE21&displaylang=en
Sincerely,
Anthony Thomas

"moharil" <sid_m15@.yahoo.com> wrote in message
news:DCFB87D2-813A-4707-8D8B-9EDB6E781058@.microsoft.com...
> i have just installed sql clinet
> (Microsoft SQL Enterprise Manager Microsoft Corporation Version: 8.0)
> on windows XP sp2 . whenever i try to reg new sql servers through
Enterprise
> Mgr it gives me this error . it looks like its associated with ODBC . need
to
> figure out whats the problem
> --
> Thanks & Regards
> Sid