Showing posts with label application. Show all posts
Showing posts with label application. Show all posts

Friday, March 30, 2012

Print Icon does not function

Hello,

I display my reports through ReportViewer embedded into my ASP.Net application. The Print icon on the ReportViewer works fine on my computer but on other computers. It does not bring the window so that user select the printer. And sometimes I see "Problems with this web page might prevent it from being displayed properly"

Why does this happen and how can I resolve it for all the computers.

Jim H.

For some reason - I like you - you are always encountering a problem - which means you experiment!

Have you installed SP2 of RS?

First of all, tell me your configuration!@.

I can help!

Joe

|||

Once again, have you installed SP2 of RS?

sql

print from toolbar

Hello, I have created an asp.net application using VS .Net 2003, which has a Report Viewer to include reports from my report manager.

The reportviewer has been set to include the standard toolbar, which includes the print button. However, when I use this option, the system prints more pages than it should. If the report is 2 pages long, I end up getting 6 pages, the other four having just the header and footer...(2 blanks pages after each page when port. ana 1 black after each page if landscape)

Any1 know the solution to this problem? I have not coded anything for the print option....

Thanks :)

Check the width of your reports. If it is too wide then printing it will create extra pages.

micro-geek

Print event in ReportViewer?

Hi All,

How can I use the Print event of ReportViewer control in my web application? I am trying to print a server report automatically so that the user does not have to click on the Print button in the tool bar of the report viewer.

I came across one article that talks about the Print event -

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

But I could not find it in VS2005 version that I am using.

Please let me know if there is a method to print the report automatically other than exporting it to some file and printing it from there.

Any help will be greatly appreciated!!!

I am trying Using System.Drawing.Printing, but failed!

Anyone help me!

|||

You only get the Print event in the WinForms version of the ReportViewer control, not in the WebForms version. Perhaps you are in a web-app?

Take a look at the sample printer delivery extension that ships with the product: It will allow you to send a report to a printer without even first viewing it (although you could view it, too, if you wanted to...)

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

sql

Print event in ReportViewer?

Hi All,

How can I use the Print event of ReportViewer control in my web application? I am trying to print a server report automatically so that the user does not have to click on the Print button in the tool bar of the report viewer.

I came across one article that talks about the Print event -

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

But I could not find it in VS2005 version that I am using.

Please let me know if there is a method to print the report automatically other than exporting it to some file and printing it from there.

Any help will be greatly appreciated!!!

I am trying Using System.Drawing.Printing, but failed!

Anyone help me!

|||

You only get the Print event in the WinForms version of the ReportViewer control, not in the WebForms version. Perhaps you are in a web-app?

Take a look at the sample printer delivery extension that ships with the product: It will allow you to send a report to a printer without even first viewing it (although you could view it, too, if you wanted to...)

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

Print Error messge

Hi,

When iam trying to print the report from the application i.e winforms application, at the first time it is displaying the Security waring(pop up message)

Do you want to install the software?

Name:Microssoft Sqlserver

Publisher:Microsoft

with Install and don't install buttons.

Once we install , from the next time printing it is not displaying this error message.

Whether it is of IE version Problem.

Thanks in advance.


What you are seeing is not an error message, but a security warning asking whether you really want to install the print control software. The printing functionality is provided by an ActiveX control, and is not built into the browser. Once it is installed on a machine, it is not necessary to install the control again (unless there is an update to the control), which is why you do not see the message again.

Ian

Wednesday, March 28, 2012

Print directly frm PDF format

hi,
is there any ways to print the reports directly frm the web application by
rendering the reports to pdf format?
regards
AngelaThe user will have to export the report to PDF first and then print. There
is no way for Report Manager to automate this.
--
-Daniel
This posting is provided "AS IS" with no warranties, and confers no rights.
"Angela" <Angela@.discussions.microsoft.com> wrote in message
news:36443488-ED64-4175-87E0-B01DDAD07DF6@.microsoft.com...
> hi,
> is there any ways to print the reports directly frm the web application by
> rendering the reports to pdf format?
> regards
> Angela|||hi,
in that case, there is no other way whereby i can call to print the report
directly from my application? because i have tried rendering my report to
html format and the print result is different from reporting services print.
because the page number is different.And i cant use the method
"&rs:Command=Get&rc:GetImage=8.00.1038.00RSClientPrint.html" because it will
promt the user the option to select printer whereby my user will print multi
reports at a click. so this will result the active x to prompt multi print
dialog.
regards
Angela
"Daniel Reib [MSFT]" wrote:
> The user will have to export the report to PDF first and then print. There
> is no way for Report Manager to automate this.
> --
> -Daniel
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Angela" <Angela@.discussions.microsoft.com> wrote in message
> news:36443488-ED64-4175-87E0-B01DDAD07DF6@.microsoft.com...
> > hi,
> > is there any ways to print the reports directly frm the web application by
> > rendering the reports to pdf format?
> >
> > regards
> > Angela
>
>|||That is correct. You would need to solve this in your application. Your
app could display EMF rather then HTML and then just print the EMF and the
user would be viewing what they would print, however you would loose
interactivity.
The problem with using HTML is it does not print nicely. This is why we
created the ActiveX control to print reports. The activeX control uses EMF
to print reports. Because this is a different format (different from HTML)
the pages don't always line up. RS does not expose any mechanism for
printing the current HTML page.
--
-Daniel
This posting is provided "AS IS" with no warranties, and confers no rights.
"Angela" <Angela@.discussions.microsoft.com> wrote in message
news:9E2C9F73-67EF-4D54-B294-61ADBA4A2FA1@.microsoft.com...
> hi,
> in that case, there is no other way whereby i can call to print the report
> directly from my application? because i have tried rendering my report to
> html format and the print result is different from reporting services
> print.
> because the page number is different.And i cant use the method
> "&rs:Command=Get&rc:GetImage=8.00.1038.00RSClientPrint.html" because it
> will
> promt the user the option to select printer whereby my user will print
> multi
> reports at a click. so this will result the active x to prompt multi print
> dialog.
> regards
> Angela
>
> "Daniel Reib [MSFT]" wrote:
>> The user will have to export the report to PDF first and then print.
>> There
>> is no way for Report Manager to automate this.
>> --
>> -Daniel
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>> "Angela" <Angela@.discussions.microsoft.com> wrote in message
>> news:36443488-ED64-4175-87E0-B01DDAD07DF6@.microsoft.com...
>> > hi,
>> > is there any ways to print the reports directly frm the web application
>> > by
>> > rendering the reports to pdf format?
>> >
>> > regards
>> > Angela
>>|||hi,
so in that case can i say i jux format my reports to EMF rather den html to
get the issue solve?
or is there an example or smaple for this calling format?
regrads
Angela
"Daniel Reib [MSFT]" wrote:
> That is correct. You would need to solve this in your application. Your
> app could display EMF rather then HTML and then just print the EMF and the
> user would be viewing what they would print, however you would loose
> interactivity.
> The problem with using HTML is it does not print nicely. This is why we
> created the ActiveX control to print reports. The activeX control uses EMF
> to print reports. Because this is a different format (different from HTML)
> the pages don't always line up. RS does not expose any mechanism for
> printing the current HTML page.
> --
> -Daniel
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Angela" <Angela@.discussions.microsoft.com> wrote in message
> news:9E2C9F73-67EF-4D54-B294-61ADBA4A2FA1@.microsoft.com...
> > hi,
> > in that case, there is no other way whereby i can call to print the report
> > directly from my application? because i have tried rendering my report to
> > html format and the print result is different from reporting services
> > print.
> > because the page number is different.And i cant use the method
> > "&rs:Command=Get&rc:GetImage=8.00.1038.00RSClientPrint.html" because it
> > will
> > promt the user the option to select printer whereby my user will print
> > multi
> > reports at a click. so this will result the active x to prompt multi print
> > dialog.
> >
> > regards
> > Angela
> >
> >
> > "Daniel Reib [MSFT]" wrote:
> >
> >> The user will have to export the report to PDF first and then print.
> >> There
> >> is no way for Report Manager to automate this.
> >>
> >> --
> >> -Daniel
> >> This posting is provided "AS IS" with no warranties, and confers no
> >> rights.
> >>
> >>
> >> "Angela" <Angela@.discussions.microsoft.com> wrote in message
> >> news:36443488-ED64-4175-87E0-B01DDAD07DF6@.microsoft.com...
> >> > hi,
> >> > is there any ways to print the reports directly frm the web application
> >> > by
> >> > rendering the reports to pdf format?
> >> >
> >> > regards
> >> > Angela
> >>
> >>
> >>
>
>

Print data from an ASP.NET ReportViewer that contains multiple pages from FireFox?

Hi,

I have this application in which I am using a number of reports containing one or more pages. When using IE as explorer, the printing button is be?ng displayed properly. When clicking that button, everything works as it should. But when using Firefox as browser, the print button doesn't show up. So I thought about going to the menu of the browser and choose File > Print. The result looks just like a printscreen and when the report contains multiple pages, I am not able to print them in a decent way.

On the internet I read the main reason for this is that Firefox does not work with ActiveX-Objects. In this way it would not be possible to print out the pages!

Can anyone help me out?

Thx a lot!

Recloose!

Anyone?

Print Button

I have a web application with a stand alone report. When I put the ReportViewer in the webform I can see every reports in the project. The problem is that I can't see the print report button...

If I indicate that the report is a "Server Report" instead a local report the Print Report appear, but a need a "Local Report" not a "Server Report" How can i solve that.

Thank you.The ASP.NET version of the ReportViewer control does not support client print (which is accomplished with an ActiveX control) in local mode. We are considering adding this in a future release.

Print

When executing a print statment in a stored procedure that is called from an
odbc application. The procedure stops without any furhter information.
SQLServer 2000 sp3
Jones
"Ricky Jones" wrote:

> When executing a print statment in a stored procedure that is called from an
> odbc application. The procedure stops without any furhter information.
> SQLServer 2000 sp3
> --
> Jones
Just to let people know that in certain cases when you apply patch
SQL2000-KB810185-8.00.0859 executing a sqlserver stored procedure print
statments will fail and cause the procedure to stop execting imedialty with
no error messages.

Monday, March 26, 2012

Print

How to incoporate with vs application using soap method please guide me
advance thanks
RajaI'm not exactly sure what you are asking. You want to use the print control
object via SOAP? This can't be done, it is an activeX control and it uses
URL access to render reports.
You can create your own printing logic and call SOAP to render each page in
the format you wish to use for printing. The control uses EMF and then uses
GDI to print to the printer.
--
-Daniel
This posting is provided "AS IS" with no warranties, and confers no rights.
"Raja Mohamed" <Raja@.photoninfotech.com> wrote in message
news:Opv2c$hSFHA.720@.TK2MSFTNGP10.phx.gbl...
> How to incoporate with vs application using soap method please guide me
> advance thanks
> Raja
>|||Actually, in the ReadME it talks about the RSClientPrint object in the API.
I guess this isn't a web service, but it's how to Print the report other
than the URL Access method.
- Joel
"Daniel Reib (MSFT)" <danreib@.online.microsoft.com> wrote in message
news:ekO0Bp1SFHA.3308@.TK2MSFTNGP14.phx.gbl...
> I'm not exactly sure what you are asking. You want to use the print
> control object via SOAP? This can't be done, it is an activeX control and
> it uses URL access to render reports.
> You can create your own printing logic and call SOAP to render each page
> in the format you wish to use for printing. The control uses EMF and then
> uses GDI to print to the printer.
> --
> -Daniel
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
> "Raja Mohamed" <Raja@.photoninfotech.com> wrote in message
> news:Opv2c$hSFHA.720@.TK2MSFTNGP10.phx.gbl...
>> How to incoporate with vs application using soap method please guide me
>> advance thanks
>> Raja
>|||Yes, the RSClientPrint object can be used in your own html. You just need
to set the object tag and call the method correctly.
--
-Daniel
This posting is provided "AS IS" with no warranties, and confers no rights.
"Joel Rumerman" <JRumerman@.prometheuslabs.com> wrote in message
news:uNCV8x2SFHA.3228@.TK2MSFTNGP10.phx.gbl...
> Actually, in the ReadME it talks about the RSClientPrint object in the
> API. I guess this isn't a web service, but it's how to Print the report
> other than the URL Access method.
> - Joel
>
> "Daniel Reib (MSFT)" <danreib@.online.microsoft.com> wrote in message
> news:ekO0Bp1SFHA.3308@.TK2MSFTNGP14.phx.gbl...
>> I'm not exactly sure what you are asking. You want to use the print
>> control object via SOAP? This can't be done, it is an activeX control
>> and it uses URL access to render reports.
>> You can create your own printing logic and call SOAP to render each page
>> in the format you wish to use for printing. The control uses EMF and
>> then uses GDI to print to the printer.
>> --
>> -Daniel
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>> "Raja Mohamed" <Raja@.photoninfotech.com> wrote in message
>> news:Opv2c$hSFHA.720@.TK2MSFTNGP10.phx.gbl...
>> How to incoporate with vs application using soap method please guide me
>> advance thanks
>> Raja
>>
>|||daniel can u plz post a simple example of html that uses rsclientprint
activex control and its print method i ll b greatful
moreover plz let me know that either i need anyother file to use that
control than rsclientprint.dll
thanx in advance
--
Message posted via http://www.sqlmonster.com|||There is sample code in the readme for using the print control in html. You
need all of the assemblies in the .cab file for the print control to work.
--
-Daniel
This posting is provided "AS IS" with no warranties, and confers no rights.
"Muhammad Hammad via SQLMonster.com" <forum@.SQLMonster.com> wrote in message
news:a9250f7bbde844ebb135df6dc0b9d738@.SQLMonster.com...
> daniel can u plz post a simple example of html that uses rsclientprint
> activex control and its print method i ll b greatful
> moreover plz let me know that either i need anyother file to use that
> control than rsclientprint.dll
> thanx in advance
> --
> Message posted via http://www.sqlmonster.com

Print

When executing a print statment in a stored procedure that is called from an
odbc application. The procedure stops without any furhter information.
SQLServer 2000 sp3
--
Jones"Ricky Jones" wrote:

> When executing a print statment in a stored procedure that is called from
an
> odbc application. The procedure stops without any furhter information.
> SQLServer 2000 sp3
> --
> Jones
Just to let people know that in certain cases when you apply patch
SQL2000-KB810185-8.00.0859 executing a sqlserver stored procedure print
statments will fail and cause the procedure to stop execting imedialty with
no error messages.

PrimaryKey consisting of two PKs with autoincrement?

I want to create a table where I can make a history of a file, while it's
processed by my application. The file will change and even get a new file, so
I created a Document table and a Journal table. The Journal table contains
the time, the event that did occure and a FK to the Document table. One line
represents a specific document (one unique file).
I added two primary keys to this table, one for the transaction and one for
the document itself. So always when a file changes (gets a new file) a new
line will be inserted with a new document key, but the same transaction key.
When a completly new file gets processed a new transaction should start and
the document key will again begin by zero.
I just would like to new if it is possible to make the document key
autoincremental, so that I don't have to worry about it in the application. I
don't really think that the transaction key can be made autoincremental, as
the database does not know, if it is a completly new file or just a new
version of an older file.
But could there be any problems with making the document key
autoincremental? I just want it to be zero again, every time a new
transaction key starts, but I think the database will just count on.
Hi
Take a look at an INDETITY property that is a good choice for artificial
keys.
"Stampede" <Stampede@.discussions.microsoft.com> wrote in message
news:F835C787-5BC8-4835-A31D-D38C4EA581A1@.microsoft.com...
> I want to create a table where I can make a history of a file, while it's
> processed by my application. The file will change and even get a new file,
so
> I created a Document table and a Journal table. The Journal table contains
> the time, the event that did occure and a FK to the Document table. One
line
> represents a specific document (one unique file).
> I added two primary keys to this table, one for the transaction and one
for
> the document itself. So always when a file changes (gets a new file) a new
> line will be inserted with a new document key, but the same transaction
key.
> When a completly new file gets processed a new transaction should start
and
> the document key will again begin by zero.
> I just would like to new if it is possible to make the document key
> autoincremental, so that I don't have to worry about it in the
application. I
> don't really think that the transaction key can be made autoincremental,
as
> the database does not know, if it is a completly new file or just a new
> version of an older file.
> But could there be any problems with making the document key
> autoincremental? I just want it to be zero again, every time a new
> transaction key starts, but I think the database will just count on.

PrimaryKey consisting of two PKs with autoincrement?

I want to create a table where I can make a history of a file, while it's
processed by my application. The file will change and even get a new file, so
I created a Document table and a Journal table. The Journal table contains
the time, the event that did occure and a FK to the Document table. One line
represents a specific document (one unique file).
I added two primary keys to this table, one for the transaction and one for
the document itself. So always when a file changes (gets a new file) a new
line will be inserted with a new document key, but the same transaction key.
When a completly new file gets processed a new transaction should start and
the document key will again begin by zero.
I just would like to new if it is possible to make the document key
autoincremental, so that I don't have to worry about it in the application. I
don't really think that the transaction key can be made autoincremental, as
the database does not know, if it is a completly new file or just a new
version of an older file.
But could there be any problems with making the document key
autoincremental? I just want it to be zero again, every time a new
transaction key starts, but I think the database will just count on.Hi
Take a look at an INDETITY property that is a good choice for artificial
keys.
"Stampede" <Stampede@.discussions.microsoft.com> wrote in message
news:F835C787-5BC8-4835-A31D-D38C4EA581A1@.microsoft.com...
> I want to create a table where I can make a history of a file, while it's
> processed by my application. The file will change and even get a new file,
so
> I created a Document table and a Journal table. The Journal table contains
> the time, the event that did occure and a FK to the Document table. One
line
> represents a specific document (one unique file).
> I added two primary keys to this table, one for the transaction and one
for
> the document itself. So always when a file changes (gets a new file) a new
> line will be inserted with a new document key, but the same transaction
key.
> When a completly new file gets processed a new transaction should start
and
> the document key will again begin by zero.
> I just would like to new if it is possible to make the document key
> autoincremental, so that I don't have to worry about it in the
application. I
> don't really think that the transaction key can be made autoincremental,
as
> the database does not know, if it is a completly new file or just a new
> version of an older file.
> But could there be any problems with making the document key
> autoincremental? I just want it to be zero again, every time a new
> transaction key starts, but I think the database will just count on.

PrimaryKey consisting of two PKs with autoincrement?

I want to create a table where I can make a history of a file, while it's
processed by my application. The file will change and even get a new file, s
o
I created a Document table and a Journal table. The Journal table contains
the time, the event that did occure and a FK to the Document table. One line
represents a specific document (one unique file).
I added two primary keys to this table, one for the transaction and one for
the document itself. So always when a file changes (gets a new file) a new
line will be inserted with a new document key, but the same transaction key.
When a completly new file gets processed a new transaction should start and
the document key will again begin by zero.
I just would like to new if it is possible to make the document key
autoincremental, so that I don't have to worry about it in the application.
I
don't really think that the transaction key can be made autoincremental, as
the database does not know, if it is a completly new file or just a new
version of an older file.
But could there be any problems with making the document key
autoincremental? I just want it to be zero again, every time a new
transaction key starts, but I think the database will just count on.Hi
Take a look at an INDETITY property that is a good choice for artificial
keys.
"Stampede" <Stampede@.discussions.microsoft.com> wrote in message
news:F835C787-5BC8-4835-A31D-D38C4EA581A1@.microsoft.com...
> I want to create a table where I can make a history of a file, while it's
> processed by my application. The file will change and even get a new file,
so
> I created a Document table and a Journal table. The Journal table contains
> the time, the event that did occure and a FK to the Document table. One
line
> represents a specific document (one unique file).
> I added two primary keys to this table, one for the transaction and one
for
> the document itself. So always when a file changes (gets a new file) a new
> line will be inserted with a new document key, but the same transaction
key.
> When a completly new file gets processed a new transaction should start
and
> the document key will again begin by zero.
> I just would like to new if it is possible to make the document key
> autoincremental, so that I don't have to worry about it in the
application. I
> don't really think that the transaction key can be made autoincremental,
as
> the database does not know, if it is a completly new file or just a new
> version of an older file.
> But could there be any problems with making the document key
> autoincremental? I just want it to be zero again, every time a new
> transaction key starts, but I think the database will just count on.

Friday, March 23, 2012

Primary keys

my PKs are out of order. my application relies on the order of these keys.
How do i put back on order ex.
current: desired:
1 1
2 2
5 3
6 4
7 5
Thanks...
drop and recreate the column as PK.
"mmc" <mmc@.discussions.microsoft.com> wrote in message
news:A7B43C62-8E2A-4100-AD63-09E4B8DB5139@.microsoft.com...
> my PKs are out of order. my application relies on the order of these keys.
> How do i put back on order ex.
> current: desired:
> 1 1
> 2 2
> 5 3
> 6 4
> 7 5
> Thanks...
|||This is a common misunderstanding. A table, by definition, has no order.
You cannot rely on any physical ordering of rows; a clustered index is not a
guarantee. The only safe way to guarantee order in a query is to use an
order by clause.
Beware of small test data sets and simplistic queries; these will appear to
support your invalid assumption.
"mmc" <mmc@.discussions.microsoft.com> wrote in message
news:A7B43C62-8E2A-4100-AD63-09E4B8DB5139@.microsoft.com...
> my PKs are out of order. my application relies on the order of these keys.
> How do i put back on order ex.
> current: desired:
> 1 1
> 2 2
> 5 3
> 6 4
> 7 5
> Thanks...
|||Use ORDER BY when you query the table. A table has no pre-determined order.
All you have done wrong is to fail to specify the order you require.
David Portas
SQL Server MVP
|||"Scott Morris" <bogus@.bogus.com> wrote in message
news:u4def5AzEHA.2036@.TK2MSFTNGP12.phx.gbl...
> This is a common misunderstanding. A table, by definition, has no order.
> You cannot rely on any physical ordering of rows; a clustered index is not
a
> guarantee. The only safe way to guarantee order in a query is to use an
> order by clause.
I thnk what mmc actually means is they are out of sequence.
My guess is he's using an IDENTITY value.

> Beware of small test data sets and simplistic queries; these will appear
to[vbcol=seagreen]
> support your invalid assumption.
> "mmc" <mmc@.discussions.microsoft.com> wrote in message
> news:A7B43C62-8E2A-4100-AD63-09E4B8DB5139@.microsoft.com...
keys.
>
|||As per Greg's suggestion, it looks like you may have an IDENTITY column with
gaps in the sequence (not "out of order" at all). Don't rely on the IDENTITY
column being sequential without gaps. You can't prevent gaps from happening
with IDENTITY so you should change your code to work correctly with this in
mind.
I would also suggest that it's unwise to rely on the sequential nature of
IDENTITY at all. There are situations where this will cause you problems and
the best rule is to assume NOTHING about the IDENTITY sequence and write
your code accordingly. Don't even assume an IDENTITY column will be unique
unless you have a unique constraint on it. Adding a DATETIME column to the
table is a better way to track the order of insertion, if that is your goal.
David Portas
SQL Server MVP
|||Thank you, David.
"David Portas" wrote:

> As per Greg's suggestion, it looks like you may have an IDENTITY column with
> gaps in the sequence (not "out of order" at all). Don't rely on the IDENTITY
> column being sequential without gaps. You can't prevent gaps from happening
> with IDENTITY so you should change your code to work correctly with this in
> mind.
> I would also suggest that it's unwise to rely on the sequential nature of
> IDENTITY at all. There are situations where this will cause you problems and
> the best rule is to assume NOTHING about the IDENTITY sequence and write
> your code accordingly. Don't even assume an IDENTITY column will be unique
> unless you have a unique constraint on it. Adding a DATETIME column to the
> table is a better way to track the order of insertion, if that is your goal.
> --
> David Portas
> SQL Server MVP
> --
>
>

Primary keys

my PKs are out of order. my application relies on the order of these keys.
How do i put back on order ex.
current: desired:
1 1
2 2
5 3
6 4
7 5
Thanks...drop and recreate the column as PK.
"mmc" <mmc@.discussions.microsoft.com> wrote in message
news:A7B43C62-8E2A-4100-AD63-09E4B8DB5139@.microsoft.com...
> my PKs are out of order. my application relies on the order of these keys.
> How do i put back on order ex.
> current: desired:
> 1 1
> 2 2
> 5 3
> 6 4
> 7 5
> Thanks...|||This is a common misunderstanding. A table, by definition, has no order.
You cannot rely on any physical ordering of rows; a clustered index is not a
guarantee. The only safe way to guarantee order in a query is to use an
order by clause.
Beware of small test data sets and simplistic queries; these will appear to
support your invalid assumption.
"mmc" <mmc@.discussions.microsoft.com> wrote in message
news:A7B43C62-8E2A-4100-AD63-09E4B8DB5139@.microsoft.com...
> my PKs are out of order. my application relies on the order of these keys.
> How do i put back on order ex.
> current: desired:
> 1 1
> 2 2
> 5 3
> 6 4
> 7 5
> Thanks...|||Use ORDER BY when you query the table. A table has no pre-determined order.
All you have done wrong is to fail to specify the order you require.
--
David Portas
SQL Server MVP
--|||"Scott Morris" <bogus@.bogus.com> wrote in message
news:u4def5AzEHA.2036@.TK2MSFTNGP12.phx.gbl...
> This is a common misunderstanding. A table, by definition, has no order.
> You cannot rely on any physical ordering of rows; a clustered index is not
a
> guarantee. The only safe way to guarantee order in a query is to use an
> order by clause.
I thnk what mmc actually means is they are out of sequence.
My guess is he's using an IDENTITY value.
> Beware of small test data sets and simplistic queries; these will appear
to
> support your invalid assumption.
> "mmc" <mmc@.discussions.microsoft.com> wrote in message
> news:A7B43C62-8E2A-4100-AD63-09E4B8DB5139@.microsoft.com...
> > my PKs are out of order. my application relies on the order of these
keys.
> > How do i put back on order ex.
> > current: desired:
> > 1 1
> > 2 2
> > 5 3
> > 6 4
> > 7 5
> > Thanks...
>|||As per Greg's suggestion, it looks like you may have an IDENTITY column with
gaps in the sequence (not "out of order" at all). Don't rely on the IDENTITY
column being sequential without gaps. You can't prevent gaps from happening
with IDENTITY so you should change your code to work correctly with this in
mind.
I would also suggest that it's unwise to rely on the sequential nature of
IDENTITY at all. There are situations where this will cause you problems and
the best rule is to assume NOTHING about the IDENTITY sequence and write
your code accordingly. Don't even assume an IDENTITY column will be unique
unless you have a unique constraint on it. Adding a DATETIME column to the
table is a better way to track the order of insertion, if that is your goal.
--
David Portas
SQL Server MVP
--|||Thank you, David.
"David Portas" wrote:
> As per Greg's suggestion, it looks like you may have an IDENTITY column with
> gaps in the sequence (not "out of order" at all). Don't rely on the IDENTITY
> column being sequential without gaps. You can't prevent gaps from happening
> with IDENTITY so you should change your code to work correctly with this in
> mind.
> I would also suggest that it's unwise to rely on the sequential nature of
> IDENTITY at all. There are situations where this will cause you problems and
> the best rule is to assume NOTHING about the IDENTITY sequence and write
> your code accordingly. Don't even assume an IDENTITY column will be unique
> unless you have a unique constraint on it. Adding a DATETIME column to the
> table is a better way to track the order of insertion, if that is your goal.
> --
> David Portas
> SQL Server MVP
> --
>
>

Primary keys

my PKs are out of order. my application relies on the order of these keys.
How do i put back on order ex.
current: desired:
1 1
2 2
5 3
6 4
7 5
Thanks...drop and recreate the column as PK.
"mmc" <mmc@.discussions.microsoft.com> wrote in message
news:A7B43C62-8E2A-4100-AD63-09E4B8DB5139@.microsoft.com...
> my PKs are out of order. my application relies on the order of these keys.
> How do i put back on order ex.
> current: desired:
> 1 1
> 2 2
> 5 3
> 6 4
> 7 5
> Thanks...|||This is a common misunderstanding. A table, by definition, has no order.
You cannot rely on any physical ordering of rows; a clustered index is not a
guarantee. The only safe way to guarantee order in a query is to use an
order by clause.
Beware of small test data sets and simplistic queries; these will appear to
support your invalid assumption.
"mmc" <mmc@.discussions.microsoft.com> wrote in message
news:A7B43C62-8E2A-4100-AD63-09E4B8DB5139@.microsoft.com...
> my PKs are out of order. my application relies on the order of these keys.
> How do i put back on order ex.
> current: desired:
> 1 1
> 2 2
> 5 3
> 6 4
> 7 5
> Thanks...|||Use ORDER BY when you query the table. A table has no pre-determined order.
All you have done wrong is to fail to specify the order you require.
David Portas
SQL Server MVP
--|||"Scott Morris" <bogus@.bogus.com> wrote in message
news:u4def5AzEHA.2036@.TK2MSFTNGP12.phx.gbl...
> This is a common misunderstanding. A table, by definition, has no order.
> You cannot rely on any physical ordering of rows; a clustered index is not
a
> guarantee. The only safe way to guarantee order in a query is to use an
> order by clause.
I thnk what mmc actually means is they are out of sequence.
My guess is he's using an IDENTITY value.

> Beware of small test data sets and simplistic queries; these will appear
to
> support your invalid assumption.
> "mmc" <mmc@.discussions.microsoft.com> wrote in message
> news:A7B43C62-8E2A-4100-AD63-09E4B8DB5139@.microsoft.com...
keys.[vbcol=seagreen]
>|||As per Greg's suggestion, it looks like you may have an IDENTITY column with
gaps in the sequence (not "out of order" at all). Don't rely on the IDENTITY
column being sequential without gaps. You can't prevent gaps from happening
with IDENTITY so you should change your code to work correctly with this in
mind.
I would also suggest that it's unwise to rely on the sequential nature of
IDENTITY at all. There are situations where this will cause you problems and
the best rule is to assume NOTHING about the IDENTITY sequence and write
your code accordingly. Don't even assume an IDENTITY column will be unique
unless you have a unique constraint on it. Adding a DATETIME column to the
table is a better way to track the order of insertion, if that is your goal.
David Portas
SQL Server MVP
--|||Thank you, David.
"David Portas" wrote:

> As per Greg's suggestion, it looks like you may have an IDENTITY column wi
th
> gaps in the sequence (not "out of order" at all). Don't rely on the IDENTI
TY
> column being sequential without gaps. You can't prevent gaps from happenin
g
> with IDENTITY so you should change your code to work correctly with this i
n
> mind.
> I would also suggest that it's unwise to rely on the sequential nature of
> IDENTITY at all. There are situations where this will cause you problems a
nd
> the best rule is to assume NOTHING about the IDENTITY sequence and write
> your code accordingly. Don't even assume an IDENTITY column will be unique
> unless you have a unique constraint on it. Adding a DATETIME column to the
> table is a better way to track the order of insertion, if that is your goa
l.
> --
> David Portas
> SQL Server MVP
> --
>
>

Primary key, Identity, Integrity constraints

Hi,

We will be using SQL Compact Edition in our application. We are doing some tests to make sure that SQL Compact is suitable for our requirments.

Our problem is with Primary keys and how to maintain data integrity since we will have 100+ clients inserting, updating, and synchronizing with SQL Server.

Can we control Identity range?

Shall we use UniqueIdentifires insted of int?

How can we detect errors at the client side? (For example, if two clients are trying to synchronize 2 columns with the same primary key value)

We will use Merge replication.

Thank you

First, understand that a SQLCe database is SINGLE user. If you want to share the data, you'll need to replicate to a SQL Server Workgroup edition or better. In this case, you'll need to use UniqueIdentifiers to make sure each separate database has unique values for the PKs. This is discussed in my new EBook. See www.hitchhikerguides.net.sql

Wednesday, March 21, 2012

Primary Key problem in db transfer Access to SQL server

I have an application initially made with Cold Fusion and Access.
I have transferred the db from Access to SQL Server and all the code works fine except for the INSERT statement. SQL Server does not generate an automatic primary key... 'o( any ideas?what was an autonumber in access is an IDENTITY column in sql/server

if you are doing INSERT statements, you do not mention the identity column (same as in access)

if you need to preserve the numbers that existed in the access tables, you can do that (look up the bcp utility and BULK INSERT KEEPIDENTITY in Books Online)

rudy
http://rudy.ca/|||Thanks!

Tuesday, March 20, 2012

Primary Key / Referntial Integrity Question

Hi,

I am supporting an application that was converted from ACCESS to SQL
Server 2000. My question focuses on two particuliar tables. The
parent table has 14000 rows while child table has over 9 million rows.
Referential integrity is set up between the two tables. The parent
table has a composite primary key of:
CustomerId (int)
LocationId (int)
ProductId (int)

The child table has a composite primary key of:
CustomerId (int)
LocationId (int)
ProductId (int)
InvTime (datetime)

A constraint between the parent and child table consists of:
CustomerId
LocationId
TankId

I have been asked to write an application that will allow users to
update the Customerid and LocationId columns of the parent table. My
program works fine when you update just one parent record but if you
try and update 30 parent records I get a timeout error. I believe the
bottleneck is the constraint between the parent and child tables.
Outside of re-designing the tables (NOTE: I was not the original
DBA/Developer), does anyone have any suggestions I can do to improve
performance for my app?

ThanksRodney King () writes:
> I am supporting an application that was converted from ACCESS to SQL
> Server 2000. My question focuses on two particuliar tables. The
> parent table has 14000 rows while child table has over 9 million rows.
> Referential integrity is set up between the two tables. The parent
> table has a composite primary key of:
> CustomerId (int)
> LocationId (int)
> ProductId (int)
> The child table has a composite primary key of:
> CustomerId (int)
> LocationId (int)
> ProductId (int)
> InvTime (datetime)
> A constraint between the parent and child table consists of:
> CustomerId
> LocationId
> TankId
> I have been asked to write an application that will allow users to
> update the Customerid and LocationId columns of the parent table. My
> program works fine when you update just one parent record but if you
> try and update 30 parent records I get a timeout error. I believe the
> bottleneck is the constraint between the parent and child tables.
> Outside of re-designing the tables (NOTE: I was not the original
> DBA/Developer), does anyone have any suggestions I can do to improve
> performance for my app?

I assume that the referential integrity is set up with ON UPDATE CASCADE?

First all, are there any triggers on the tables? In such case, what
do they do?

Next, what are the indexes on the tables? Obviosly the PKs are indexes,
but are the clustered or non-clustered?

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Thanks for responding.
1) To answer your questions I have full Delete/Update cascade on my
constraint.

2) There are no DB triggers and here are the indexes on my tables:

3) Indexes are as follows:
Master table:
Primary Key, Unique, Nonclustered index on:
CustomerId,LocationId,ProductId

Child table:
Nonclustered index on:
CustomerId,LocationId,ProductId

Nonclustered index on:
MinNumber

Primary Key, Unique, Nonclustered index on:
ProductId,InvTime

When I run the following query in SQL Query Analyzer:

Update MasterTable set Customerid=23,LocationId=34 where CustomerId=44
and LocationId=788 and ProductId=91022

My Explain plan tells me that a full table scan would be performed
against my child table. However, if I perform the same statement
against my Child table, the Explain plan uses my Nonclustered index of
CustomerId,LocationId and ProductId

Can you tell me what's going on?

Thanks
On Wed, 8 Dec 2004 20:52:38 +0000 (UTC), Erland Sommarskog
<esquel@.sommarskog.se> wrote:

>Rodney King () writes:
>> I am supporting an application that was converted from ACCESS to SQL
>> Server 2000. My question focuses on two particuliar tables. The
>> parent table has 14000 rows while child table has over 9 million rows.
>> Referential integrity is set up between the two tables. The parent
>> table has a composite primary key of:
>> CustomerId (int)
>> LocationId (int)
>> ProductId (int)
>>
>> The child table has a composite primary key of:
>> CustomerId (int)
>> LocationId (int)
>> ProductId (int)
>> InvTime (datetime)
>>
>> A constraint between the parent and child table consists of:
>> CustomerId
>> LocationId
>> TankId
>>
>> I have been asked to write an application that will allow users to
>> update the Customerid and LocationId columns of the parent table. My
>> program works fine when you update just one parent record but if you
>> try and update 30 parent records I get a timeout error. I believe the
>> bottleneck is the constraint between the parent and child tables.
>> Outside of re-designing the tables (NOTE: I was not the original
>> DBA/Developer), does anyone have any suggestions I can do to improve
>> performance for my app?
>I assume that the referential integrity is set up with ON UPDATE CASCADE?
>First all, are there any triggers on the tables? In such case, what
>do they do?
>Next, what are the indexes on the tables? Obviosly the PKs are indexes,
>but are the clustered or non-clustered?|||Rodney King () writes:
> Thanks for responding.
> 1) To answer your questions I have full Delete/Update cascade on my
> constraint.
> 2) There are no DB triggers and here are the indexes on my tables:
> 3) Indexes are as follows:
> Master table:
> Primary Key, Unique, Nonclustered index on:
> CustomerId,LocationId,ProductId
> Child table:
> Nonclustered index on:
> CustomerId,LocationId,ProductId
> Nonclustered index on:
> MinNumber
> Primary Key, Unique, Nonclustered index on:
> ProductId,InvTime

Do I read this right that there are no clustered indexes? While an update
to the clustered index would be more costly, locating the rows will be
faster.

The problem now is that the optimizer estimates that using the non-clustered
index on the table will be more expensive than a table scan. This is not
that strange as it sounds. If you need to access 50% of the rows in a
table, this is lot more expensive to do through a non-clustered index
than a table scan. (Because you will need to access many pages more
than once.) The optimizer therefor tends to be somewhat conservative
in its use of nonclustered indexes.

If you don't want to change the index to a clustered index, an UPDATE
STATISTICS WITH FULLSCAN on the tables may help, but I would not really
count on it.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp