Showing posts with label back. Show all posts
Showing posts with label back. Show all posts

Wednesday, March 28, 2012

Problems in opening the Enterprise Manager

Hi,

I had one perfectly windows a 2003 with the SP2 and SQL Server twirling. Later that I came back the server toward the SP1 I I do not obtain more to enter in the Enterprise Manager. It of the o error

MMC Cannot open file “….\ SQL Server Enterprise Manager.MSC”

Somebody could help me?

Reinstall client tools... some dll might have got corrupted..

Madhu

Monday, March 26, 2012

Problems getting all the data back with a XML query

I am having a nightmare trying to get to the bottom of this problem.
I have a stored procedure that has a user defined function to create a
select table from a csv string of IDs.
The function and the Stored procedure works fine and returns the XML,
Elements as required except that when i process this sp on the client most
of the data is missing.
If i run the query in the query analyser with the csv parameter and no FOR
XML output i get 72 records (10 unique resources, the rest are due to the
joins in the query)
If i run it with the FOR XML i get 6 lines of XML although it is oddly
truncated. If i cut and past it into xmlspy there are missing elements so i
can't verify exactly what i'm getting.
But when i run this in my web app and use am XMLTextReader to turn the
results into a string I get 2 records, when i was expecting 10. I can verify
this by pasting the xml into xmlspy.
I have tried SQLXML managed classes but can't get them to accept parameters,
i keep getting the message that the sp is expecting parameter despite using
createParameter against the command as per all the documentation, so i gave
up with this approach. I thought that this way i could populate a new
dataset and then bind a table to a datagrid control to see what was
returned. I can get it all to work bar the parameters.
Can anyone shed any light on why the results are significantly less than the
sp should return
and can someone give me an example of working with a parameterised sp and
SQLXML
Many thanks
John
VS2003, SQLXML sp2, XPpro sp2
I am confused about what you are trying to get.
FOR XML results a single XML stream if you use the supported APIs through
ADO.Net, ADO, or OLEDB's stream interfaces. Query Analyser is using ODBC and
thus shows the XML result junked into 2033 characters per row. You should
not use QA if you plan on further process the result.
So if you can provide us with some more information about what exactly you
do on the API level, we may be able to help...
Best regards
Michael
"John Mas" <mase@.btopenworld.org> wrote in message
news:G2x8d.316$Xy3.217@.newsfe6-gui.ntli.net...
>I am having a nightmare trying to get to the bottom of this problem.
> I have a stored procedure that has a user defined function to create a
> select table from a csv string of IDs.
> The function and the Stored procedure works fine and returns the XML,
> Elements as required except that when i process this sp on the client most
> of the data is missing.
> If i run the query in the query analyser with the csv parameter and no FOR
> XML output i get 72 records (10 unique resources, the rest are due to the
> joins in the query)
> If i run it with the FOR XML i get 6 lines of XML although it is oddly
> truncated. If i cut and past it into xmlspy there are missing elements so
> i can't verify exactly what i'm getting.
> But when i run this in my web app and use am XMLTextReader to turn the
> results into a string I get 2 records, when i was expecting 10. I can
> verify this by pasting the xml into xmlspy.
> I have tried SQLXML managed classes but can't get them to accept
> parameters, i keep getting the message that the sp is expecting parameter
> despite using createParameter against the command as per all the
> documentation, so i gave up with this approach. I thought that this way i
> could populate a new dataset and then bind a table to a datagrid control
> to see what was returned. I can get it all to work bar the parameters.
> Can anyone shed any light on why the results are significantly less than
> the sp should return
> and can someone give me an example of working with a parameterised sp and
> SQLXML
>
> Many thanks
> John
> VS2003, SQLXML sp2, XPpro sp2
>
|||Xref: TK2MSFTNGP08.phx.gbl microsoft.public.sqlserver.xml:25072
Michael,
thanks I have sorted the problem eventually. Brain fade and not enough time
thinking it throgh. The problem was in the sql statement which took ages to
track down but there we go.
One question that is unanswered is how do i pass parameters to SQLXML with
stored procedures, not raw sql text?
i keep getting the message expecting parameter as per my post
thanks
john
"Michael Rys [MSFT]" <mrys@.online.microsoft.com> wrote in message
news:Ok7uv9DrEHA.2796@.TK2MSFTNGP10.phx.gbl...
>I am confused about what you are trying to get.
> FOR XML results a single XML stream if you use the supported APIs through
> ADO.Net, ADO, or OLEDB's stream interfaces. Query Analyser is using ODBC
> and thus shows the XML result junked into 2033 characters per row. You
> should not use QA if you plan on further process the result.
> So if you can provide us with some more information about what exactly you
> do on the API level, we may be able to help...
> Best regards
> Michael
> "John Mas" <mase@.btopenworld.org> wrote in message
> news:G2x8d.316$Xy3.217@.newsfe6-gui.ntli.net...
>
|||To what exactly do you want to pass parameters? SQLXML is a general term and
the name of the mid-tier component.
Do you mean how to pass parameters into the SQL statement that uses FOR XML
via stored procs?
Thanks
Michael
"John Mas" <mase@.btopenworld.org> wrote in message
news:Fmz9d.270$Vd.96@.newsfe5-win.ntli.net...
> Michael,
> thanks I have sorted the problem eventually. Brain fade and not enough
> time thinking it throgh. The problem was in the sql statement which took
> ages to track down but there we go.
> One question that is unanswered is how do i pass parameters to SQLXML with
> stored procedures, not raw sql text?
> i keep getting the message expecting parameter as per my post
> thanks
> john
>
> "Michael Rys [MSFT]" <mrys@.online.microsoft.com> wrote in message
> news:Ok7uv9DrEHA.2796@.TK2MSFTNGP10.phx.gbl...
>
|||Michael
here is the code that i am using
Dim strConn = "provider=SQLOLEDB;data source='....';initial
catalog=......;user id=sa;password=......"
Dim sxcCmd As New SqlXmlCommand(strConn)
Dim sdaDA As New SqlXmlAdapter(sxcCmd)
Dim sxpParam As SqlXmlParameter
Dim xr As Xml.XmlReader
Dim ds As New DataSet
With sxcCmd
..RootTag = "root"
..CommandType = SqlXmlCommandType.Sql
..CommandText = "Test2"
sxpParam = .CreateParameter
End With
With sxpParam
..Name = "@.IDs"
..Value = 5
End With
sdaDA.Fill(ds)
DataGrid1.DataSource = ds.Tables(0)
and here is the sp
ALTER PROCEDURE dbo.test2
(
@.IDs int
)
AS
/* SET NOCOUNT ON */
SELECT '<root>'
SELECT * FROM tblResource WHERE ResourceID=@.Ids
FOR XML AUTO, Elements
SELECT '</root>'
as you can see the sp has this parameter @.IDs but when i run the code the
error meesage says ' expecting parameter @.IDs'' yet i am passing it. If i
change the command text to a sql statement with a ? for the parameter then
it works.
Obviously i am missing something here, I presume the command type might be
wrongly set.
thanks
john
"Michael Rys [MSFT]" <mrys@.online.microsoft.com> wrote in message
news:O45cbdZrEHA.1964@.TK2MSFTNGP12.phx.gbl...
> To what exactly do you want to pass parameters? SQLXML is a general term
> and the name of the mid-tier component.
> Do you mean how to pass parameters into the SQL statement that uses FOR
> XML via stored procs?
> Thanks
> Michael
> "John Mas" <mase@.btopenworld.org> wrote in message
> news:Fmz9d.270$Vd.96@.newsfe5-win.ntli.net...
>

Tuesday, March 20, 2012

Problems backing up SQL DB.

Every time i try to back up a specific DB i get an error saying it can
not backup because the full text catalog is not permitted because it
is not online. It does not matter if i try to backup the db through
SQL of my Backup software. here is the sql log.

LogJob History (DB File level Backup.Subplan_1)

Step ID1
ServerServer Name
Job NameDB File level Backup.Subplan_1
Step NameSubplan_1
Duration00:00:01
Sql Severity0
Sql Message ID0
Operator Emailed
Operator Net sent
Operator Paged
Retries Attempted0

Message
Executed as user: Domain\USer. ...ecute Package Utility Version
9.00.3042.00 for 32-bit Copyright (C) Microsoft Corp 1984-2005. All
rights reserved. Started: 7:07:43 AM Progress: 2007-06-01
07:07:44.14 Source: {B6285A6A-0066-416F-AD9F-F31ED5A68F14}
Executing query "DECLARE @.Guid UNIQUEIDENTIFIER EXECUTE
msdb..sp".: 100% complete End Progress Error: 2007-06-01
07:07:44.49 Code: 0xC002F210 Source: Back Up Database (Full)
Execute SQL Task Description: Executing the query "BACKUP DATABASE
[DBName] FILEGROUP = N'PRIMARY' TO DISK = N'E:\Program Files
\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\DBName_200706010707.ba k'
WITH NOFORMAT, NOINIT, NAME = N'DBName_backup_20070601070744', SKIP,
REWIND, NOUNLOAD, STATS = 10 " failed with the following error: "The
backup of full-text catalog 'ftcat_documentindex' is not permitted
because it is not online. Check errorlog file for the reason that full-
text catalog became offline and . The step failed.Bryan (bsockel@.gmail.com) writes:

Quote:

Originally Posted by

Every time i try to back up a specific DB i get an error saying it can
not backup because the full text catalog is not permitted because it
is not online. It does not matter if i try to backup the db through
SQL of my Backup software. here is the sql log.


Searching Books Online on "fulltext offline", I found this link:

ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/sqlerrm9/html/592bd03e-7f46-4b88-9bd0-
7a0b32cbfd58.htm

It seems that there is a chance that you find the answer there.
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

Friday, March 9, 2012

Problem: Identity seed

I have an Identity field in a table with many records. Since the database is
corrupt, I recreated the table and loaded the original data back into the
new table.
I want to make sure the Identity field keep incrementing its value from the
max value instead of starting from 1 again.
Here is what I did:
Before I loading the data, I set the IDENTITY_INSERT ON and set it off when
the data was loaded. However, the new records' identity field value still
start
from the 1. :-(
I don't want to change the identity seed (it must be "1"). Is there any
other way I can achieve the goal?
Thanks a lot,
LX
You can use IDENTITY_INSERT ON, load your data, turn it OFF and then reset
the seed to the max, using DBCC CHECKIDENT.
Tom
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
"FLX" <nospam@.hotmail.com> wrote in message
news:OTOc$g3jEHA.3196@.TK2MSFTNGP10.phx.gbl...
I have an Identity field in a table with many records. Since the database is
corrupt, I recreated the table and loaded the original data back into the
new table.
I want to make sure the Identity field keep incrementing its value from the
max value instead of starting from 1 again.
Here is what I did:
Before I loading the data, I set the IDENTITY_INSERT ON and set it off when
the data was loaded. However, the new records' identity field value still
start
from the 1. :-(
I don't want to change the identity seed (it must be "1"). Is there any
other way I can achieve the goal?
Thanks a lot,
LX
|||No. What you're trying to do is in violation of the use of an identity
column. Its sole purpose is to increment a value defined by the seed and
step. Identity_insert allows you to insert into an identity column, but the
system will do a check of the newly inserted and reset the seed if the new
value is larger than the current seed.
Bol has this thoroughly documented under 'set identity_insert'.
"FLX" <nospam@.hotmail.com> wrote in message
news:OTOc$g3jEHA.3196@.TK2MSFTNGP10.phx.gbl...
> I have an Identity field in a table with many records. Since the database
is
> corrupt, I recreated the table and loaded the original data back into the
> new table.
> I want to make sure the Identity field keep incrementing its value from
the
> max value instead of starting from 1 again.
> Here is what I did:
> Before I loading the data, I set the IDENTITY_INSERT ON and set it off
when
> the data was loaded. However, the new records' identity field value still
> start
> from the 1. :-(
> I don't want to change the identity seed (it must be "1"). Is there any
> other way I can achieve the goal?
> Thanks a lot,
> LX
>

Problem: Identity seed

I have an Identity field in a table with many records. Since the database is
corrupt, I recreated the table and loaded the original data back into the
new table.
I want to make sure the Identity field keep incrementing its value from the
max value instead of starting from 1 again.
Here is what I did:
Before I loading the data, I set the IDENTITY_INSERT ON and set it off when
the data was loaded. However, the new records' identity field value still
start
from the 1. :-(
I don't want to change the identity seed (it must be "1"). Is there any
other way I can achieve the goal?
Thanks a lot,
LXYou can use IDENTITY_INSERT ON, load your data, turn it OFF and then reset
the seed to the max, using DBCC CHECKIDENT.
--
Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
"FLX" <nospam@.hotmail.com> wrote in message
news:OTOc$g3jEHA.3196@.TK2MSFTNGP10.phx.gbl...
I have an Identity field in a table with many records. Since the database is
corrupt, I recreated the table and loaded the original data back into the
new table.
I want to make sure the Identity field keep incrementing its value from the
max value instead of starting from 1 again.
Here is what I did:
Before I loading the data, I set the IDENTITY_INSERT ON and set it off when
the data was loaded. However, the new records' identity field value still
start
from the 1. :-(
I don't want to change the identity seed (it must be "1"). Is there any
other way I can achieve the goal?
Thanks a lot,
LX|||No. What you're trying to do is in violation of the use of an identity
column. Its sole purpose is to increment a value defined by the seed and
step. Identity_insert allows you to insert into an identity column, but the
system will do a check of the newly inserted and reset the seed if the new
value is larger than the current seed.
Bol has this thoroughly documented under 'set identity_insert'.
"FLX" <nospam@.hotmail.com> wrote in message
news:OTOc$g3jEHA.3196@.TK2MSFTNGP10.phx.gbl...
> I have an Identity field in a table with many records. Since the database
is
> corrupt, I recreated the table and loaded the original data back into the
> new table.
> I want to make sure the Identity field keep incrementing its value from
the
> max value instead of starting from 1 again.
> Here is what I did:
> Before I loading the data, I set the IDENTITY_INSERT ON and set it off
when
> the data was loaded. However, the new records' identity field value still
> start
> from the 1. :-(
> I don't want to change the identity seed (it must be "1"). Is there any
> other way I can achieve the goal?
> Thanks a lot,
> LX
>

Problem: Identity seed

I have an Identity field in a table with many records. Since the database is
corrupt, I recreated the table and loaded the original data back into the
new table.
I want to make sure the Identity field keep incrementing its value from the
max value instead of starting from 1 again.
Here is what I did:
Before I loading the data, I set the IDENTITY_INSERT ON and set it off when
the data was loaded. However, the new records' identity field value still
start
from the 1. :-(
I don't want to change the identity seed (it must be "1"). Is there any
other way I can achieve the goal?
Thanks a lot,
LXYou can use IDENTITY_INSERT ON, load your data, turn it OFF and then reset
the seed to the max, using DBCC CHECKIDENT.
Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
"FLX" <nospam@.hotmail.com> wrote in message
news:OTOc$g3jEHA.3196@.TK2MSFTNGP10.phx.gbl...
I have an Identity field in a table with many records. Since the database is
corrupt, I recreated the table and loaded the original data back into the
new table.
I want to make sure the Identity field keep incrementing its value from the
max value instead of starting from 1 again.
Here is what I did:
Before I loading the data, I set the IDENTITY_INSERT ON and set it off when
the data was loaded. However, the new records' identity field value still
start
from the 1. :-(
I don't want to change the identity seed (it must be "1"). Is there any
other way I can achieve the goal?
Thanks a lot,
LX|||No. What you're trying to do is in violation of the use of an identity
column. Its sole purpose is to increment a value defined by the seed and
step. Identity_insert allows you to insert into an identity column, but the
system will do a check of the newly inserted and reset the seed if the new
value is larger than the current seed.
Bol has this thoroughly documented under 'set identity_insert'.
"FLX" <nospam@.hotmail.com> wrote in message
news:OTOc$g3jEHA.3196@.TK2MSFTNGP10.phx.gbl...
> I have an Identity field in a table with many records. Since the database
is
> corrupt, I recreated the table and loaded the original data back into the
> new table.
> I want to make sure the Identity field keep incrementing its value from
the
> max value instead of starting from 1 again.
> Here is what I did:
> Before I loading the data, I set the IDENTITY_INSERT ON and set it off
when
> the data was loaded. However, the new records' identity field value still
> start
> from the 1. :-(
> I don't want to change the identity seed (it must be "1"). Is there any
> other way I can achieve the goal?
> Thanks a lot,
> LX
>

Saturday, February 25, 2012

Problem with Views

A while back I ran into a problem where changes to views (such as renaming
them) was not being reflected. Somehow I was able to get past this problem.
Now I want to generate a script that will create my views. When I look at
the script that was generated has old information; the old names, and the old
queries.
Is there something I'm overlooking when I make changes to views?
Ensure that you are not creating views with different owners other than
DBO... It's possible that you are getting messed up with different version
of the same view owned by different owners..
Wayne Snyder MCDBA, SQL Server MVP
Mariner, Charlotte, NC
(Please respond only to the newsgroup.)
I support the Professional Association for SQL Server ( PASS) and it's
community of SQL Professionals.
"Tracy" <Tracy@.discussions.microsoft.com> wrote in message
news:711B82B3-D80C-4EA4-9014-7EA62C8DF370@.microsoft.com...
>A while back I ran into a problem where changes to views (such as renaming
> them) was not being reflected. Somehow I was able to get past this
> problem.
> Now I want to generate a script that will create my views. When I look at
> the script that was generated has old information; the old names, and the
> old
> queries.
> Is there something I'm overlooking when I make changes to views?
|||DBO is the only user for this DB. Each create statement in the generated
script looks like this: CREATE VIEW dbo.someview. The problem is that these
view names and associated querys are old, the way the were before I renamed
them and made changes to the queries.
Thanks for your quick reply,
-Tracy
"Wayne Snyder" wrote:

> Ensure that you are not creating views with different owners other than
> DBO... It's possible that you are getting messed up with different version
> of the same view owned by different owners..
>
> --
> Wayne Snyder MCDBA, SQL Server MVP
> Mariner, Charlotte, NC
> (Please respond only to the newsgroup.)
> I support the Professional Association for SQL Server ( PASS) and it's
> community of SQL Professionals.
> "Tracy" <Tracy@.discussions.microsoft.com> wrote in message
> news:711B82B3-D80C-4EA4-9014-7EA62C8DF370@.microsoft.com...
>
>
|||On Tue, 16 Aug 2005 09:55:04 -0700, Tracy wrote:

>DBO is the only user for this DB. Each create statement in the generated
>script looks like this: CREATE VIEW dbo.someview. The problem is that these
>view names and associated querys are old, the way the were before I renamed
>them and made changes to the queries.
>Thanks for your quick reply,
>-Tracy
Hi Tracy,
How did you rename the queries? Did you execute a sp_rename? Or did you
open the view definition, change the name and execute it? In the latter
case, you didn't rename it - you made a new view (with a new name),
based on the old view. You'll still have to drop the old view.
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)
|||Using SQL Server Enterprise Manager (v8.0) I renamed the views the Windows
Explorer way: Highlight the item, single click it, type in the new name.
I generated another script just now, but this time I left the "Generate the
DROP <object>" checked. The script had DROP commands for the current views,
but the CREATE VIEWs were all the old view names and queries.
"Hugo Kornelis" wrote:

> On Tue, 16 Aug 2005 09:55:04 -0700, Tracy wrote:
>
> Hi Tracy,
> How did you rename the queries? Did you execute a sp_rename? Or did you
> open the view definition, change the name and execute it? In the latter
> case, you didn't rename it - you made a new view (with a new name),
> based on the old view. You'll still have to drop the old view.
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)
>
|||X-Newsreader: Forte Agent 1.91/32.564
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Complaints-To: abuse@.supernews.com
Lines: 29
Path: TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!news.osn.de!diablo1-ffm.news.osn.de!news.tele.dk!news.tele.dk!small.ne ws.tele.dk!sn-xit-03!sn-xit-10!sn-xit-01!sn-post-01!supernews.com!corp.supernews.com!not-for-mail
Xref: TK2MSFTNGP08.phx.gbl microsoft.public.sqlserver.server:403053
On Wed, 17 Aug 2005 06:45:03 -0700, Tracy wrote:

>Using SQL Server Enterprise Manager (v8.0) I renamed the views the Windows
>Explorer way: Highlight the item, single click it, type in the new name.
Hi Tracy,
Thanks - I never even knew that you could rename objects that way as
well!
However, the best way to rename views, stored procedures, triggers, and
user-defined functions is to explicitly drop and recreate them. Here's a
recent post by Tibor Karaszi about what goes wrong:
(Warning - long URL, check for line wrapping)
http://groups.google.com/groups?hl=e...aszi&safe=off&
qt_s=Search

>I generated another script just now, but this time I left the "Generate the
>DROP <object>" checked. The script had DROP commands for the current views,
>but the CREATE VIEWs were all the old view names and queries.
That's how you should rename your objects next time, but it won't help
now. I guess you'll have to manually change the name in the scripts.
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)
|||Thank you!
I was able to do in-depth research with the starting point you gave me.
I executed "select * from information_schema.views" and found that the
"view_definition" column had the old names. I was a little hasty in my
conclusion that the queries were old as well. I checked them thoroughly and
they look to be correct.
So to solve my current problem, I just need to change the names in the
generated script and then run the script, (including the DROPs).
In the future, I will try to get by without renaming. But if I must rename
the views, I will copy the query, drop the view, create a new view, paste the
query, and save it with the new name.
That's a lot more steps than simply doing the Explorer-style rename, but it
will save a lot of grief in the long run.
Thanks again, Hugo and Wayne, for your help
-Tracy
"Hugo Kornelis" wrote:

> Thanks - I never even knew that you could rename objects that way as
> well!
> However, the best way to rename views, stored procedures, triggers, and
> user-defined functions is to explicitly drop and recreate them. Here's a
> recent post by Tibor Karaszi about what goes wrong:
> (Warning - long URL, check for line wrapping)
> http://groups.google.com/groups?hl=e...araszi&safe=of
f&qt_s=Search
>
|||On Thu, 18 Aug 2005 06:50:08 -0700, Tracy wrote:
(snip)
>In the future, I will try to get by without renaming. But if I must rename
>the views, I will copy the query, drop the view, create a new view, paste the
>query, and save it with the new name.
>That's a lot more steps than simply doing the Explorer-style rename, but it
>will save a lot of grief in the long run.
Hi Tracy,
Slightly shorter: generate a script including the DROP command; edit the
script (but only chage the name on the CREATE command) and execute it.
Better yet: store all DDL for your tables, views, procs, etc outside of
SQL Server - preferably in source control.
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)

Problem with Views

A while back I ran into a problem where changes to views (such as renaming
them) was not being reflected. Somehow I was able to get past this problem.
Now I want to generate a script that will create my views. When I look at
the script that was generated has old information; the old names, and the ol
d
queries.
Is there something I'm overlooking when I make changes to views?Ensure that you are not creating views with different owners other than
DBO... It's possible that you are getting messed up with different version
of the same view owned by different owners..
Wayne Snyder MCDBA, SQL Server MVP
Mariner, Charlotte, NC
(Please respond only to the newsgroup.)
I support the Professional Association for SQL Server ( PASS) and it's
community of SQL Professionals.
"Tracy" <Tracy@.discussions.microsoft.com> wrote in message
news:711B82B3-D80C-4EA4-9014-7EA62C8DF370@.microsoft.com...
>A while back I ran into a problem where changes to views (such as renaming
> them) was not being reflected. Somehow I was able to get past this
> problem.
> Now I want to generate a script that will create my views. When I look at
> the script that was generated has old information; the old names, and the
> old
> queries.
> Is there something I'm overlooking when I make changes to views?|||DBO is the only user for this DB. Each create statement in the generated
script looks like this: CREATE VIEW dbo.someview. The problem is that these
view names and associated querys are old, the way the were before I renamed
them and made changes to the queries.
Thanks for your quick reply,
-Tracy
"Wayne Snyder" wrote:

> Ensure that you are not creating views with different owners other than
> DBO... It's possible that you are getting messed up with different versio
n
> of the same view owned by different owners..
>
> --
> Wayne Snyder MCDBA, SQL Server MVP
> Mariner, Charlotte, NC
> (Please respond only to the newsgroup.)
> I support the Professional Association for SQL Server ( PASS) and it's
> community of SQL Professionals.
> "Tracy" <Tracy@.discussions.microsoft.com> wrote in message
> news:711B82B3-D80C-4EA4-9014-7EA62C8DF370@.microsoft.com...
>
>|||On Tue, 16 Aug 2005 09:55:04 -0700, Tracy wrote:

>DBO is the only user for this DB. Each create statement in the generated
>script looks like this: CREATE VIEW dbo.someview. The problem is that thes
e
>view names and associated querys are old, the way the were before I renamed
>them and made changes to the queries.
>Thanks for your quick reply,
>-Tracy
Hi Tracy,
How did you rename the queries? Did you execute a sp_rename? Or did you
open the view definition, change the name and execute it? In the latter
case, you didn't rename it - you made a new view (with a new name),
based on the old view. You'll still have to drop the old view.
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||Using SQL Server Enterprise Manager (v8.0) I renamed the views the Windows
Explorer way: Highlight the item, single click it, type in the new name.
I generated another script just now, but this time I left the "Generate the
DROP <object>" checked. The script had DROP commands for the current views,
but the CREATE VIEWs were all the old view names and queries.
"Hugo Kornelis" wrote:

> On Tue, 16 Aug 2005 09:55:04 -0700, Tracy wrote:
>
> Hi Tracy,
> How did you rename the queries? Did you execute a sp_rename? Or did you
> open the view definition, change the name and execute it? In the latter
> case, you didn't rename it - you made a new view (with a new name),
> based on the old view. You'll still have to drop the old view.
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)
>|||X-Newsreader: Forte Agent 1.91/32.564
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Complaints-To: abuse@.supernews.com
Lines: 29
Path: TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-online.de!newsfeed.f
reenet.de!news.osn.de!diablo1-ffm.news.osn.de!news.tele.dk!news.tele.dk!smal
l.news.tele.dk!sn-xit-03!sn-xit-10!sn-xit-01!sn-post-01!supernews.com!corp.s
upernews.com!not-for-mail
Xref: TK2MSFTNGP08.phx.gbl microsoft.public.sqlserver.server:403053
On Wed, 17 Aug 2005 06:45:03 -0700, Tracy wrote:

>Using SQL Server Enterprise Manager (v8.0) I renamed the views the Windows
>Explorer way: Highlight the item, single click it, type in the new name.
Hi Tracy,
Thanks - I never even knew that you could rename objects that way as
well!
However, the best way to rename views, stored procedures, triggers, and
user-defined functions is to explicitly drop and recreate them. Here's a
recent post by Tibor Karaszi about what goes wrong:
(Warning - long URL, check for line wrapping)
http://groups.google.com/groups?hl=...r />
safe=off&
qt_s=Search

>I generated another script just now, but this time I left the "Generate the
>DROP <object>" checked. The script had DROP commands for the current views
,
>but the CREATE VIEWs were all the old view names and queries.
That's how you should rename your objects next time, but it won't help
now. I guess you'll have to manually change the name in the scripts.
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||Thank you!
I was able to do in-depth research with the starting point you gave me.
I executed "select * from information_schema.views" and found that the
"view_definition" column had the old names. I was a little hasty in my
conclusion that the queries were old as well. I checked them thoroughly and
they look to be correct.
So to solve my current problem, I just need to change the names in the
generated script and then run the script, (including the DROPs).
In the future, I will try to get by without renaming. But if I must rename
the views, I will copy the query, drop the view, create a new view, paste th
e
query, and save it with the new name.
That's a lot more steps than simply doing the Explorer-style rename, but it
will save a lot of grief in the long run.
Thanks again, Hugo and Wayne, for your help
-Tracy
"Hugo Kornelis" wrote:

> Thanks - I never even knew that you could rename objects that way as
> well!
> However, the best way to rename views, stored procedures, triggers, and
> user-defined functions is to explicitly drop and recreate them. Here's a
> recent post by Tibor Karaszi about what goes wrong:
> (Warning - long URL, check for line wrapping)
> http://groups.google.com/groups?hl=...Karaszi&safe=of
f&qt_s=Search
>|||On Thu, 18 Aug 2005 06:50:08 -0700, Tracy wrote:
(snip)
>In the future, I will try to get by without renaming. But if I must rename
>the views, I will copy the query, drop the view, create a new view, paste t
he
>query, and save it with the new name.
>That's a lot more steps than simply doing the Explorer-style rename, but it
>will save a lot of grief in the long run.
Hi Tracy,
Slightly shorter: generate a script including the DROP command; edit the
script (but only chage the name on the CREATE command) and execute it.
Better yet: store all DDL for your tables, views, procs, etc outside of
SQL Server - preferably in source control.
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)

Problem with Views

A while back I ran into a problem where changes to views (such as renaming
them) was not being reflected. Somehow I was able to get past this problem.
Now I want to generate a script that will create my views. When I look at
the script that was generated has old information; the old names, and the old
queries.
Is there something I'm overlooking when I make changes to views?Ensure that you are not creating views with different owners other than
DBO... It's possible that you are getting messed up with different version
of the same view owned by different owners..
Wayne Snyder MCDBA, SQL Server MVP
Mariner, Charlotte, NC
(Please respond only to the newsgroup.)
I support the Professional Association for SQL Server ( PASS) and it's
community of SQL Professionals.
"Tracy" <Tracy@.discussions.microsoft.com> wrote in message
news:711B82B3-D80C-4EA4-9014-7EA62C8DF370@.microsoft.com...
>A while back I ran into a problem where changes to views (such as renaming
> them) was not being reflected. Somehow I was able to get past this
> problem.
> Now I want to generate a script that will create my views. When I look at
> the script that was generated has old information; the old names, and the
> old
> queries.
> Is there something I'm overlooking when I make changes to views?|||DBO is the only user for this DB. Each create statement in the generated
script looks like this: CREATE VIEW dbo.someview. The problem is that these
view names and associated querys are old, the way the were before I renamed
them and made changes to the queries.
Thanks for your quick reply,
-Tracy
"Wayne Snyder" wrote:
> Ensure that you are not creating views with different owners other than
> DBO... It's possible that you are getting messed up with different version
> of the same view owned by different owners..
>
> --
> Wayne Snyder MCDBA, SQL Server MVP
> Mariner, Charlotte, NC
> (Please respond only to the newsgroup.)
> I support the Professional Association for SQL Server ( PASS) and it's
> community of SQL Professionals.
> "Tracy" <Tracy@.discussions.microsoft.com> wrote in message
> news:711B82B3-D80C-4EA4-9014-7EA62C8DF370@.microsoft.com...
> >A while back I ran into a problem where changes to views (such as renaming
> > them) was not being reflected. Somehow I was able to get past this
> > problem.
> >
> > Now I want to generate a script that will create my views. When I look at
> > the script that was generated has old information; the old names, and the
> > old
> > queries.
> >
> > Is there something I'm overlooking when I make changes to views?
>
>|||On Tue, 16 Aug 2005 09:55:04 -0700, Tracy wrote:
>DBO is the only user for this DB. Each create statement in the generated
>script looks like this: CREATE VIEW dbo.someview. The problem is that these
>view names and associated querys are old, the way the were before I renamed
>them and made changes to the queries.
>Thanks for your quick reply,
>-Tracy
Hi Tracy,
How did you rename the queries? Did you execute a sp_rename? Or did you
open the view definition, change the name and execute it? In the latter
case, you didn't rename it - you made a new view (with a new name),
based on the old view. You'll still have to drop the old view.
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||Using SQL Server Enterprise Manager (v8.0) I renamed the views the Windows
Explorer way: Highlight the item, single click it, type in the new name.
I generated another script just now, but this time I left the "Generate the
DROP <object>" checked. The script had DROP commands for the current views,
but the CREATE VIEWs were all the old view names and queries.
"Hugo Kornelis" wrote:
> On Tue, 16 Aug 2005 09:55:04 -0700, Tracy wrote:
> >DBO is the only user for this DB. Each create statement in the generated
> >script looks like this: CREATE VIEW dbo.someview. The problem is that these
> >view names and associated querys are old, the way the were before I renamed
> >them and made changes to the queries.
> >
> >Thanks for your quick reply,
> >-Tracy
> Hi Tracy,
> How did you rename the queries? Did you execute a sp_rename? Or did you
> open the view definition, change the name and execute it? In the latter
> case, you didn't rename it - you made a new view (with a new name),
> based on the old view. You'll still have to drop the old view.
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)
>|||On Wed, 17 Aug 2005 06:45:03 -0700, Tracy wrote:
>Using SQL Server Enterprise Manager (v8.0) I renamed the views the Windows
>Explorer way: Highlight the item, single click it, type in the new name.
Hi Tracy,
Thanks - I never even knew that you could rename objects that way as
well!
However, the best way to rename views, stored procedures, triggers, and
user-defined functions is to explicitly drop and recreate them. Here's a
recent post by Tibor Karaszi about what goes wrong:
(Warning - long URL, check for line wrapping)
http://groups.google.com/groups?hl=en&lr=&safe=off&num=10&q=syscomments+group%3Amicrosoft.public.sqlserver.programming+insubject%3ARenaming+insubject%3Astored+insubject%3Aprocedures+insubject%3Ain+insubject%3Abulk+author%3ATibor+author%3AKaraszi&safe=off&qt_s=Search
>I generated another script just now, but this time I left the "Generate the
>DROP <object>" checked. The script had DROP commands for the current views,
>but the CREATE VIEWs were all the old view names and queries.
That's how you should rename your objects next time, but it won't help
now. I guess you'll have to manually change the name in the scripts.
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||Thank you!
I was able to do in-depth research with the starting point you gave me.
I executed "select * from information_schema.views" and found that the
"view_definition" column had the old names. I was a little hasty in my
conclusion that the queries were old as well. I checked them thoroughly and
they look to be correct.
So to solve my current problem, I just need to change the names in the
generated script and then run the script, (including the DROPs).
In the future, I will try to get by without renaming. But if I must rename
the views, I will copy the query, drop the view, create a new view, paste the
query, and save it with the new name.
That's a lot more steps than simply doing the Explorer-style rename, but it
will save a lot of grief in the long run.
Thanks again, Hugo and Wayne, for your help
-Tracy
"Hugo Kornelis" wrote:
> Thanks - I never even knew that you could rename objects that way as
> well!
> However, the best way to rename views, stored procedures, triggers, and
> user-defined functions is to explicitly drop and recreate them. Here's a
> recent post by Tibor Karaszi about what goes wrong:
> (Warning - long URL, check for line wrapping)
> http://groups.google.com/groups?hl=en&lr=&safe=off&num=10&q=syscomments+group%3Amicrosoft.public.sqlserver.programming+insubject%3ARenaming+insubject%3Astored+insubject%3Aprocedures+insubject%3Ain+insubject%3Abulk+author%3ATibor+author%3AKaraszi&safe=off&qt_s=Search
>|||On Thu, 18 Aug 2005 06:50:08 -0700, Tracy wrote:
(snip)
>In the future, I will try to get by without renaming. But if I must rename
>the views, I will copy the query, drop the view, create a new view, paste the
>query, and save it with the new name.
>That's a lot more steps than simply doing the Explorer-style rename, but it
>will save a lot of grief in the long run.
Hi Tracy,
Slightly shorter: generate a script including the DROP command; edit the
script (but only chage the name on the CREATE command) and execute it.
Better yet: store all DDL for your tables, views, procs, etc outside of
SQL Server - preferably in source control.
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)

Monday, February 20, 2012

Problem with UpdatePanel with Trigger, using MasterPage

Hi all,

I have a MasterPage with Calendar Control, and a content page with ListBox control.
My plan is to have a post back on the ListBox, when the Calendar control "SelectionChanged" event fires.
Both the Calendar control and the ListBox control are child elements of separate UpdatePanel controls.

I have this code fragment in the content page "Load" event handler.

if (!IsPostBack)
{
Microsoft.Web.UI.AsyncPostBackTrigger trigger = new
Microsoft.Web.UI.AsyncPostBackTrigger();
trigger.ControlID = master.CalendarStartDate.ClientID.ToString();
trigger.EventName = "SelectionChanged";
UpdatePanelItemMovers.Triggers.Add(trigger);
}

But when the page loads, I get this error:

A control with ID 'ctl00_ctl00_RightSidePlaceHolder_calendarStartDate' could not be found for the trigger in UpdatePanel 'UpdatePanelItemMovers'

Can someone tell me why?

Any luck on this. I'm having the exact same problem.|||I get the same problem using markup. This is the complete page, which uses a very simple master page that has just 2 content areas.

<%@. Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:ScriptManager id="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:Button ID="Button1" runat="server" Text="Click" /><br />
Time: <%= DateTime.Now.ToLongTimeString() %>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
<asp:UpdatePanel id="UpdatePanel1" runat="server">
<contenttemplate>
Time: <%= DateTime.Now.ToLongTimeString() %>
</contenttemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</asp:Content>

If I move the button into the Content2 placeholder, it works fine.|||One answer is to add the trigger using code:

protected void Page_Init()
{
Microsoft.Web.UI.AsyncPostBackTrigger trigger = new Microsoft.Web.UI.AsyncPostBackTrigger();
trigger.EventName = "Click";
trigger.ControlID = Button1.UniqueID.ToString();
UpdatePanel1.Triggers.Add(trigger);
}

see:
http://forums.asp.net/thread/1456042.aspx|||

I don't use Triggers any more, I just manually call UpdatePanel.Update() whenever I need to update a section of the page, and the result is exactly the same as using triggers. I believe the error can be traced to the MasterPage/Content relationship, where controls are assigned some strange-looking ID's.

|||Use the ChildrenAsTriggers="false" attribute in UpdatePanel for using AsyncPostBackTrigger.

Code Snippet

<asp:UpdatePanel ID="general" runat="server" UpdateMode="conditional" ChildrenAsTriggers="false">

<Triggers>
<asp:AsyncPostBackTrigger ControlID="bt_envia" EventName="Click" />
</Triggers>

Problem with UpdatePanel with Trigger, using MasterPage

Hi all,

I have a MasterPage with Calendar Control, and a content page with ListBox control.
My plan is to have a post back on the ListBox, when the Calendar control "SelectionChanged" event fires.
Both the Calendar control and the ListBox control are child elements of separate UpdatePanel controls.

I have this code fragment in the content page "Load" event handler.

if (!IsPostBack)
{
Microsoft.Web.UI.AsyncPostBackTrigger trigger = new
Microsoft.Web.UI.AsyncPostBackTrigger();
trigger.ControlID = master.CalendarStartDate.ClientID.ToString();
trigger.EventName = "SelectionChanged";
UpdatePanelItemMovers.Triggers.Add(trigger);
}

But when the page loads, I get this error:

A control with ID 'ctl00_ctl00_RightSidePlaceHolder_calendarStartDate' could not be found for the trigger in UpdatePanel 'UpdatePanelItemMovers'

Can someone tell me why?

Any luck on this. I'm having the exact same problem.|||I get the same problem using markup. This is the complete page, which uses a very simple master page that has just 2 content areas.

<%@. Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:ScriptManager id="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:Button ID="Button1" runat="server" Text="Click" /><br />
Time: <%= DateTime.Now.ToLongTimeString() %>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
<asp:UpdatePanel id="UpdatePanel1" runat="server">
<contenttemplate>
Time: <%= DateTime.Now.ToLongTimeString() %>
</contenttemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</asp:Content>

If I move the button into the Content2 placeholder, it works fine.
|||One answer is to add the trigger using code:

protected void Page_Init()
{
Microsoft.Web.UI.AsyncPostBackTrigger trigger = new Microsoft.Web.UI.AsyncPostBackTrigger();
trigger.EventName = "Click";
trigger.ControlID = Button1.UniqueID.ToString();
UpdatePanel1.Triggers.Add(trigger);
}

see:
http://forums.asp.net/thread/1456042.aspx

|||

I don't use Triggers any more, I just manually call UpdatePanel.Update() whenever I need to update a section of the page, and the result is exactly the same as using triggers. I believe the error can be traced to the MasterPage/Content relationship, where controls are assigned some strange-looking ID's.

|||Use the ChildrenAsTriggers="false" attribute in UpdatePanel for using AsyncPostBackTrigger.

Code Snippet

<asp:UpdatePanel ID="general" runat="server" UpdateMode="conditional" ChildrenAsTriggers="false">

<Triggers>
<asp:AsyncPostBackTrigger ControlID="bt_envia" EventName="Click" />
</Triggers>

Problem with update when updating all rows of a table through dataset and saving back to d

Hi,

I have an application where I'm filling a dataset with values from a table. This table has no primary key. Then I iterate through each row of the dataset and I compute the value of one of the columns and then update that value in the dataset row. The problem I'm having is that when the database gets updated by the SqlDataAdapter.Update() method, the same value shows up under that column for all rows. I think my Update Command is not correct since I'm not specifying a where clause and hence it is using just the value lastly computed in the dataset to update the entire database. But I do not know how to specify a where clause for an update statement when I'm actually updating every row in the dataset. Basically I do not have an update parameter since all rows are meant to be updated. Any suggestions?

SqlCommand snUpdate = conn.CreateCommand();

snUpdate.CommandType =CommandType.Text;

snUpdate.CommandText ="Update TestTable set shipdate = @.shipdate";

snUpdate.Parameters.Add("@.shipdate",SqlDbType.Char, 10,"shipdate");

string jdate ="";

for (int i = 0; i < ds.Tables[0].Rows.Count - 1; i++)

{

jdate = ds.Tables[0].Rows[i]["shipdate"].ToString();

ds.Tables[0].Rows[i]["shipdate"] = convertToNormalDate(jdate);

}

da.Update(ds,"Table1");

conn.Close();

-Thanks

a quick once over and i have a few questions--what all in your TestTable? Also in all lines of code you refer to your table as Tables[0] you should always stick to one way. Your right about your Update, so when we see what's in your TestTable we'll be able to help you out a little bit more.

|||

Thanks for your response. My table contains 2 fields SKU numbers and Ship Dates. I changed my update statement as follows and it worked.

snUpdate.CommandText ="Update TestTable set shipdate = @.shipdate where skunum=@.skunum";

snUpdate.Parameters.Add("@.shipdate",SqlDbType.Char, 10,"shipdate");

snUpdate.Parameters.Add("@.skunum",SqlDbType.Int, 4,"skunum");

snUpdate.Parameters["@.skunum"].SourceVersion =DataRowVersion.Original;

-Thanks

|||So is skunum a unique value? If not, then it'll update all rows with that skunum. If it is, then why isn't that your primary key?|||The skunum is not unique. The table does have some duplicated data which I don't have to worry about if they get updated with the same value. This is just an old table whose data will be transformed into a different table and used in an app after my updates are done. Thanks.