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

Tuesday, March 27, 2012

can we control how transaction send from principal to mirror ?

Hi,

can we control how transaction send from principal to mirror ?

If application inserting 10000000 rows in one transaction to principal database

how infomation will be transfered once it is commited and where it will be stored before it is replayed on mirror database?

1. Is it going to be 1 big data packet ?

2.is it going to be split on many packets (of what size ?)

Thanks

Alex

Log records are sent from principal to mirror by log block boundary (64k max). In this case, since the transaction log for the transaction will be larger than 64K, multiple log blocks will be sent to the mirror. The log records are being sent continuously -- it doesn't wait for the commit.

The log records are stored on the log files on the mirror and are are applied on the mirror database continuously.

|||

Hi Sanjay , thank for you help

can you post link where I can read about "log block boundary" in db mirroring

you wrote

> The log records are stored on the log files on the mirror and are are applied on the mirror database continuously

Do you you mean they written to .ldf file of mirrored database ?

Alex

|||

Yes, the log is written to the .ldf file of the mirror database.

Sunday, March 25, 2012

Can we call a RS report from within another VB or VBA application?

Will I be able to launch a reporting services report from within a VB/VBA
application? How would I do this?
Thanks
Ranjit CharlesThree options:
1. URL integration. Embed a IE control into any app and set the url
appropriately. Works with VB6, VB.Net, etc.
2. Web services integration. Works with VB.Net, VB6 with soap toolkit (but
can be problematic and I suggest staying away from it).
3. VB.Net 2005 use the new report control that ships with VS 2005.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Ranjit Charles" <RanjitCharles@.discussions.microsoft.com> wrote in message
news:0391CF5D-44EE-4710-BCC1-3F8CDC1CD5DD@.microsoft.com...
> Will I be able to launch a reporting services report from within a VB/VBA
> application? How would I do this?
> Thanks
> Ranjit Charlessql

Can we build Web UIs with SSRS?

If all one needs is a bunch of reports, then, instead of going the
whole hog writing a UI in a bespoke ASP.NET application, can one take
the sole refuge of SQL Server 2005 Reporting Services to do a neat UI
along with the reports?
As in, one of the parameters for a report may be a period range. Can
SSRS help me build a form with two date pickers that I can:
1. program the events of, package the date ranges, pass it to the
report and call my report file from?
2. publish the form as a Web form?
Or, does one have to rely on a bespoke ASP.NET app to do it? What are
the limits of SSRS?SSRS has its limitations.
SSRS relies greatly on how the SQL code is written.
For example, if you are using date ranges - reporting services is there
to be the middle man between presentation and data. Nothing more. All
reporting services will require is 2 parameters(start date and end
date).
Meaning SSRS will have to TEXTBOX's where the user will just enter 2
dates and it will run the report between the 2 dates. In this case
there is no validation of the paramters but i can all be handleled on
the DB side. So reporting services doesnt have built in controls where
the user will enter dates, its only there to GET parameters. These
parameters are provided in a text box.
SSRS is not a web application where the user has easy to read UI to
enter paramters. It does have a VERY nice way of displaying the
results. Its buily to display a result of a DB call, not to present the
user with a web form.
regards,
Stas K.|||Thanks, Sorcerdon. I understood what you're saying. Now let me present
a broader picture of what I'm thinking might just be possible.
I have to build a bespoke ASP.NET app, which mostly requires to use
SSRS as a backend for reporting. So, in effect, this bespoke Web app is
just to provide UI forms and call SSRS with parameters.
I was considering if it might be possible to use any of the SQL Server
2005 services (Integration, Application, Reporting, Anything Else) to
get the UI functionality also as it is, out-of-the-box.
After all, what I'll be building a bespoke application is to get a UI
to call my reports. Surely, Microsoft, with its DSI and software
factories initiative might have as well provided with some tool to
automate that as well out-of-the-box.
Thoughts?|||Actually, in SSRS 2005, there is a better implementation of the Date type
parameters, with a calendar control and input validation controls.
Thiago
--
Regards,
"Sorcerdon" wrote:
> SSRS has its limitations.
> SSRS relies greatly on how the SQL code is written.
> For example, if you are using date ranges - reporting services is there
> to be the middle man between presentation and data. Nothing more. All
> reporting services will require is 2 parameters(start date and end
> date).
> Meaning SSRS will have to TEXTBOX's where the user will just enter 2
> dates and it will run the report between the 2 dates. In this case
> there is no validation of the paramters but i can all be handleled on
> the DB side. So reporting services doesnt have built in controls where
> the user will enter dates, its only there to GET parameters. These
> parameters are provided in a text box.
> SSRS is not a web application where the user has easy to read UI to
> enter paramters. It does have a VERY nice way of displaying the
> results. Its buily to display a result of a DB call, not to present the
> user with a web form.
> regards,
> Stas K.
>|||I was solely speaking of Reporting Services 2000. My bad.
There is a UI for reporting that is built in for reporting
services(report manager). People can log in subsrcibe to report and get
it in their mail every morning. All of that is built in. And they can
run the reports at will.
The problem is that in RS2000 (I have not yet started working with 2005
until very recently) it wasnt as nice of a UI. So, perhaps a RS 2005
PRO can answer this?
As for out-of-the-box - there is always report manager. The users input
their parameters - or they are defualted to defualt parameters. It DOES
have it built in, yes!
Here are some screenies of what the report manager looks like:
http://www.windowsitpro.com/Files/09/40529/Figure_07.gif
http://msdn.microsoft.com/library/en-us/dnhcvs04/html/408dobson5.jpg
http://www.codeproject.com/books/MSReportingServices/img005.jpg
In that last screenie you can see how the parameters are inputed - in
those text boxes.
regards,
Stas K.|||Hi,
Ofcourse RS is meant for reporting and not giving some fancy UI. But yes in
2005 they have provided what is called "Report Viewer" (comes with VS2005)
which you can use it in your Asp.Net along with your UI. Want to explore ?
search for "ReportViewer Controls (Visual Studio)" in VS 2005 documentation.
Amarnath
"Water Cooler v2" wrote:
> Thanks, Sorcerdon. I understood what you're saying. Now let me present
> a broader picture of what I'm thinking might just be possible.
> I have to build a bespoke ASP.NET app, which mostly requires to use
> SSRS as a backend for reporting. So, in effect, this bespoke Web app is
> just to provide UI forms and call SSRS with parameters.
> I was considering if it might be possible to use any of the SQL Server
> 2005 services (Integration, Application, Reporting, Anything Else) to
> get the UI functionality also as it is, out-of-the-box.
> After all, what I'll be building a bespoke application is to get a UI
> to call my reports. Surely, Microsoft, with its DSI and software
> factories initiative might have as well provided with some tool to
> automate that as well out-of-the-box.
> Thoughts?
>|||Thanks everyone.
Sorcerdon and Amarnath,
Where do I find these "Report Manager" and "Report Viewer"? I cannot
see "ReportViewer Controls" in my toolbox. Do I have to import them (as
in set a reference to some assembly containing them)?
Or, is it because I do not have the complete Visual Studio 2005
Enterprise Architect Edition. I only have SQL Server 2005 Business
Intelligence Development Studio (which is basically a stripped down
version of VS .NET 2005 with only data-centric project templates).|||This is so wrong on so many levels.
I don't usually say this sort of thing but please until you learn more about
the product DO NOT jump in and answer questions.
Let's start with the most glaring problem. You state that the date would be
text with no validation. In RS 2000 there was not a date picker. In RS 2005
there is a date picker. BUT, even assuming you are on RS 2000 you are still
totally wrong. If you go to the menu Report->Report Parameters you can set
the data type for each parameter. So, even in RS 2000 there is validation
for a date field (or an integer field etc), they cannot put in a non-date if
the field should be a date field.
To say RS is not a web app that the user can enter parameters in easily is
also so totally wrong. Yes, some people prefer to have more control over
placement of controls and other things but RS comes with a totally usable
portal called Report Manager. You can have the parameters be based on a
query (so you that pick from a dropdown list). You can have cascading
parameters where the second parameter list is based on the previous
parameter. You can set defaults for the parameters, etc etc. Each report you
can place a description with it so when the user sees the list of reports
each report has a brief description. In RS 2005 you can have multi-select
parameter lists.
So in short, your answer has set this guy off on a totally wrong tangent. It
could be that the existing portal that ships with RS would fullfill all his
needs.
I know you were trying to be helpfull but you are lacking in knowledge about
the product.
--
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Sorcerdon" <sorcerdon@.gmail.com> wrote in message
news:1144686176.448071.239430@.i40g2000cwc.googlegroups.com...
> SSRS has its limitations.
> SSRS relies greatly on how the SQL code is written.
> For example, if you are using date ranges - reporting services is there
> to be the middle man between presentation and data. Nothing more. All
> reporting services will require is 2 parameters(start date and end
> date).
> Meaning SSRS will have to TEXTBOX's where the user will just enter 2
> dates and it will run the report between the 2 dates. In this case
> there is no validation of the paramters but i can all be handleled on
> the DB side. So reporting services doesnt have built in controls where
> the user will enter dates, its only there to GET parameters. These
> parameters are provided in a text box.
> SSRS is not a web application where the user has easy to read UI to
> enter paramters. It does have a VERY nice way of displaying the
> results. Its buily to display a result of a DB call, not to present the
> user with a web form.
> regards,
> Stas K.
>|||Hey Bruce,
Thanks for that RS2000 validation control re-answer. I seem to have
never known it existed - perhaps because I am running all my reports of
a web app.
Same for the second answer.
regards,
Stas K.|||I have noticed other posts of yours after my harsh response here and you
have good answers in other areas. I got a little excitable on my post.
You obviously do know other areas of the product, just not Report Manager.
--
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Sorcerdon" <sorcerdon@.gmail.com> wrote in message
news:1144787538.172402.57350@.g10g2000cwb.googlegroups.com...
> Hey Bruce,
> Thanks for that RS2000 validation control re-answer. I seem to have
> never known it existed - perhaps because I am running all my reports of
> a web app.
> Same for the second answer.
> regards,
> Stas K.
>|||Bruce,
I am actually a software developer not a report writer although I do
both.
So I really should go answer questions in other forums. In these forums
I hope to help myself learn and perfect my technique when writing
reports.
Although some questions here come from N-Users... So I am able to think
of solutions.
As for Report Manager, in this case I am the N-user ^_^ - I dont like
how it looks as a matter of fact. I want a whole new look for the whole
thing. I like a sharepoint type of look(if your familiar).
regards,
Stas K.

Thursday, March 22, 2012

Can V run DTS from an remote machine?

Hi,
i have developed an web-database enabled application, wherein the admin will be importing the data from a remote machine to the server.
Is it possible to run the DTS remotely?
Also, is there need to install the sqlserver in the remote machine on which the admin is working ? i mean to say, other than server, do i need to install sqlserver on the remote machine too..
Thanx in advance

If you are on the same Network you register the server and it becomes local to you and if needed you remote into the server and do anything it feels local. To use DTS remotely you need SQL Server Agent installed with a service account. Try the links below for configurations. Hope this helps.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_xp_aa-sz_4jxo.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_xp_aa-sz_8sdm.asp

|||Hello Kiran,
It looks as if solution of problem is not clear to you also or you are moving in wrong direction .

wherein the admin will be importing the data from a remote machine to the server.
With the help of DTS it is not possible.
Possible solution can be uploading the data to server through webapplication and then calling DTS through stored procedures in webapplication.
Other solution can be uploading files using DTS FTP task and then performing transfromation operations.



|||Hi,
thanx for the reply. i will try it out|||Hi Bhatia,
hmm, i think, the way i have put my question sounds confusion.
Lemme clearly explain u what the prob is .
I have developed an webenabled application using ASP.NET,C#,SQL server 2000. The application is all about having students database-all the universities.
Here, the admin will have the privilege to upload students data onto the database and all other users can only retrieve it.
I want to design the application such a way that, admin can upload the data onto the server remotely, mean to say, he can do that, signing in from any remote machine.
While uploading, admin should access the datatables of the server, import the data from the current machine(remote machin thru which hes signed in) onto the server.
How can i design this...hmm, how can i call the DTS of the server, signing in from the remote machine.
Hope this explains better..
|||Hello Kiran,
You must first upload the student data to the server through web application.
For uploading tutorial visit this link
http://www.aspheute.com/english/20000802.asp?PrinterFriendly=True

After the file is uploaded to server then only you can transform file to the server.
you have to create DTS package for transformation and stored procedure for calling DTS package.
1.Create a new package
Right click on package window > Package properties
-Set Global Variables
SourceText String
DestTable String

-Now Drag and drop Text file (Source) and Microsoft OLE DB Provide for SQL Server(Destination).
Connect them with Transform data task.(Add dummy data in text file and SQL Server Table to check it is working fine).
-Now add Dynamic Properties Task from Task.
Edit it.
Now set property
1.Connections > Text File(Source) > Data Source
Set Global Variables (SourceText variable)
2.Tasks > DTS Tasks > DestinationObjectName
Set Global Variables (DestTable variable)
Your workflow will set in this way
Dynamic Properties Task --->On Success--> TextFile(Source)-->Data Transfrom Task-->Microsoft OLE DB Providefor SQL Server(Destination).

Step2. Create stored procedure that will call this DTS package from web application.
CREATE Procedure DtsTransform
@.ServerName nvarchar(30),
@.UserName nvarchar(30),
@.Password nvarchar(30),
@.DtsName nvarchar(250),
@.SourceFile nvarchar(200),
@.DestTable nvarchar(200)

AS
DECLARE @.ERROR int -- For Hold Error Number
DECLARE @.CMD varchar(1000) -- Dts Run Command
DECLARE @.DtsPassword varchar(30)

BEGIN

SET @.ERROR = 0

SET @.CMD = 'dtsrun /S '+@.ServerName+' /U '+@.UserName+' /P'+@.Password+' /N '+@.DtsName +' /A SourceText:8='+ @.SourceFile +'/A DestTable:8='+ @.DestTable
EXECUTE @.ERROR = master..xp_cmdshell @.CMD
SELECT @.ERROR = COALESCE( NULLIF ( @.ERROR, 0 ), @.@.ERROR )

END
RETURN @.ERROR

GO

Hope this will solve your problem.
|||That is not correct a DTS package running with SQL Server Agent populates online back with deposits collected from AS400. The job runs for about three hours. I ran Profiler on it and watched SQL Server Agent deposit 50 transactions every three to five seconds. Search this forum I helped some one less than two months ago. If you cannot do it does not mean it is not possible. In the 1990s I started posting the need to install SQL Server Agent with service account for Replication, today click on the Replication Wizard and you will get a message telling you to do so. Technology is there for you to explore and improve. Hope this helps.|||Hi Bhatia,
well i am very new to DTS, and i dint get that DTS package transformation. I do know how to upload the file though.
can u plz explain me whats the DTS package for and how to create that?
thanks in advance
|||Hi,
i am totally confused with this. What r u trying to explain?
Thanks inadvance|||Hello Kiran,
You cannot develop all this in one flow.
Start with uploading .
See if you are able to upload student data or not .
After this shift to DTS part.( for transformation of text file to Sql server database).

Tuesday, March 20, 2012

Can this be used as a replacement for Crystal Reports?

I am not familiar with this tool. Can I create reports that can be run
from a C# application with parameters passed to it?
Any help is greatly appreciated.VS 2005 has two new controls: winform and webform. The controls can be used
in local or server mode. In server mode you give it the parameters and call
the server which the control then shows the rendered report. In local mode
you give it the report and the tableset data. However, you have to do lots
more work to handle subreports and other types of reports. My feeling is, if
you plan on not having a server around that Crystal reports is designed more
along the lines of your app providing the data. Reporting Services is
designed as a service oriented architecture and although in local mode you
can give it the data, it was not designed with that in mind. With a server
in the picture then the answer is absolutely yes.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Greg Smith" <gjs@.umn.edu> wrote in message
news:eu9RG9ZYHHA.4440@.TK2MSFTNGP03.phx.gbl...
>I am not familiar with this tool. Can I create reports that can be run
>from a C# application with parameters passed to it?
>
> Any help is greatly appreciated.

Monday, March 19, 2012

Can this be done using TSQL ?!

Hello
im writing an inventory application for a customer that needs to calculate
item cost by Moving Average method which requires calculating the cost after
each operation, i have a good experience with TSQL but so far i failed to
write the statement that can do this WITHOUT writing cursors
im trying to avoid calculating cost after each transaction to the inventory
. and by writing a stored procedure , get a list showing transactions and
item avg in a period
here is a description of moving avg method , also available here for those
who cant read html
http://www.fms.indiana.edu/auxiliary/inventory.asp
Moving Average--Perpetual
Continuous or moving average assigns a unit value to cost of goods available
for sale. In this scenario, the average cost determines cost of goods sold
at the time of each sale. This method requires a calculation of average unit
cost after each purchase as illustrated below.
# of Units Cost per Unit Total Cost Moving Avg. Cost
Beginning inventory, 7/1 200
$5,000
$25.00
Purchase, 8/10 100
$26.00
2,600
Inv. Balance 300
7,600
25.33
Sale, 9/15 (100)
25.33
(2,533)
Inv. Balance 200
5,067
Purchase, 12/7 600
27.00
16,200
Inv. Balance 800
21,267
26.58
Sale, 12/18 (300)
26.58
(7,975)
Inv. Balance 500
13,292
Sale, 2/22 (250)
26.58
(6,645
Inv. Balance 250
6,647
Purchase, 3/20 300
28.00
8,400
Inv. Balance 550
15,047
27.36
Sale, 5/15 (150)
27.36
(4,104)
Inv. Balance 400
27.36
10,943
Ending Inventory 400
10,943
Cost of Goods Sold 100
2,533
300
7,975
250
6,645
150
4,104
800
$21,257
Regards
Bassamcan you post DDL and some data..and also the example..pasted correctly..
Av.
http://dotnetjunkies.com/WebLog/avnrao
http://www28.brinkster.com/avdotnet
"Bassam" <egbas@.yahoo.com> wrote in message
news:ORrEOZODFHA.3596@.TK2MSFTNGP12.phx.gbl...
> Hello
> im writing an inventory application for a customer that needs to calculate
> item cost by Moving Average method which requires calculating the cost
after
> each operation, i have a good experience with TSQL but so far i failed to
> write the statement that can do this WITHOUT writing cursors
> im trying to avoid calculating cost after each transaction to the
inventory
> . and by writing a stored procedure , get a list showing transactions and
> item avg in a period
> here is a description of moving avg method , also available here for those
> who cant read html
> http://www.fms.indiana.edu/auxiliary/inventory.asp
> Moving Average--Perpetual
> Continuous or moving average assigns a unit value to cost of goods
available
> for sale. In this scenario, the average cost determines cost of goods sold
> at the time of each sale. This method requires a calculation of average
unit
> cost after each purchase as illustrated below.
> # of Units Cost per Unit Total Cost Moving Avg. Cost
> Beginning inventory, 7/1 200
> $5,000
> $25.00
> Purchase, 8/10 100
> $26.00
> 2,600
>
> Inv. Balance 300
> 7,600
> 25.33
> Sale, 9/15 (100)
> 25.33
> (2,533)
>
> Inv. Balance 200
> 5,067
>
> Purchase, 12/7 600
> 27.00
> 16,200
>
> Inv. Balance 800
> 21,267
> 26.58
> Sale, 12/18 (300)
> 26.58
> (7,975)
>
> Inv. Balance 500
> 13,292
>
> Sale, 2/22 (250)
> 26.58
> (6,645
>
> Inv. Balance 250
> 6,647
>
> Purchase, 3/20 300
> 28.00
> 8,400
>
> Inv. Balance 550
> 15,047
> 27.36
> Sale, 5/15 (150)
> 27.36
> (4,104)
>
> Inv. Balance 400
> 27.36
> 10,943
>
> Ending Inventory 400
> 10,943
>
> Cost of Goods Sold 100
> 2,533
>
> 300
> 7,975
>
> 250
> 6,645
>
> 150
> 4,104
>
> 800
> $21,257
>
>
> Regards
> Bassam
>|||Please post DDL and some INSERT statements of your sample data:
http://www.aspfaq.com/etiquette.asp?id=5006
--
David Portas
SQL Server MVP
--|||On Mon, 7 Feb 2005 09:27:19 +0200, Bassam wrote:

>im writing an inventory application for a customer that needs to calculate
>item cost by Moving Average method which requires calculating the cost afte
r
>each operation, i have a good experience with TSQL but so far i failed to
>write the statement that can do this WITHOUT writing cursors
Hi Bassam,
I think you can get the moving average by a simple self-join with group
by. Check the following example:
-- First, create a table to hold all transactions
-- Opening balance is considered a transaction in this simplified example
CREATE TABLE Operations
(OpDate smalldatetime not null primary key,
Amount int not null, -- >0 purchase <0 sale
UnitPrice money not null)
go
-- Insert all data (same as on web page you mentioned)
INSERT Operations (OpDate, Amount, UnitPrice)
SELECT '20040701', 200, 25
UNION ALL
SELECT '20040810', 100, 26
UNION ALL
SELECT '20040915', -100, 25.33
UNION ALL
SELECT '20041207', 600, 27
UNION ALL
SELECT '20041218', -300, 26.58
UNION ALL
SELECT '20050222', -250, 26.58
UNION ALL
SELECT '20050320', 300, 28
UNION ALL
SELECT '20050515', -150, 27.36
go
-- Here's the statement that will calculate amount, value and moving
-- average after each of the transaction.
SELECT a.OpDate AS InvDate,
SUM(b.Amount) AS Amount,
SUM(b.Amount * b.UnitPrice) AS Value,
SUM(b.Amount * b.UnitPrice) / SUM(b.Amount) AS MovingAvg
FROM Operations AS a
INNER JOIN Operations AS b
ON b.OpDate <= a.OpDate
GROUP BY a.OpDate
ORDER BY a.OpDate
go
-- Done. Now clean up the mess.
DROP TABLE Operations
go
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||Hello Hugo,
Thank you for your input but result of your statement will calculate
"Weighted Average" not "Moving Average"
difference is shown in examples in this link
http://www.fms.indiana.edu/auxiliary/inventory.asp
if you open this page and search for weighted average you fill find the
example which works with your statement but the just below example which is
for moving average won't work
i will post DDL and some data here to clear the case
Regards
Bassam
"Hugo Kornelis" <hugo@.pe_NO_rFact.in_SPAM_fo> wrote in message
news:hhme01diqfdiohvb2rj3t896k5deoc47e9@.
4ax.com...
> On Mon, 7 Feb 2005 09:27:19 +0200, Bassam wrote:
>
calculate
after
> Hi Bassam,
> I think you can get the moving average by a simple self-join with group
> by. Check the following example:
> -- First, create a table to hold all transactions
> -- Opening balance is considered a transaction in this simplified example
> CREATE TABLE Operations
> (OpDate smalldatetime not null primary key,
> Amount int not null, -- >0 purchase <0 sale
> UnitPrice money not null)
> go
> -- Insert all data (same as on web page you mentioned)
> INSERT Operations (OpDate, Amount, UnitPrice)
> SELECT '20040701', 200, 25
> UNION ALL
> SELECT '20040810', 100, 26
> UNION ALL
> SELECT '20040915', -100, 25.33
> UNION ALL
> SELECT '20041207', 600, 27
> UNION ALL
> SELECT '20041218', -300, 26.58
> UNION ALL
> SELECT '20050222', -250, 26.58
> UNION ALL
> SELECT '20050320', 300, 28
> UNION ALL
> SELECT '20050515', -150, 27.36
> go
> -- Here's the statement that will calculate amount, value and moving
> -- average after each of the transaction.
> SELECT a.OpDate AS InvDate,
> SUM(b.Amount) AS Amount,
> SUM(b.Amount * b.UnitPrice) AS Value,
> SUM(b.Amount * b.UnitPrice) / SUM(b.Amount) AS MovingAvg
> FROM Operations AS a
> INNER JOIN Operations AS b
> ON b.OpDate <= a.OpDate
> GROUP BY a.OpDate
> ORDER BY a.OpDate
> go
> -- Done. Now clean up the mess.
> DROP TABLE Operations
> go
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)|||On Mon, 7 Feb 2005 14:32:20 +0200, Bassam wrote:

>Hello Hugo,
>Thank you for your input but result of your statement will calculate
>"Weighted Average" not "Moving Average"
>difference is shown in examples in this link
>http://www.fms.indiana.edu/auxiliary/inventory.asp
>if you open this page and search for weighted average you fill find the
>example which works with your statement but the just below example which is
>for moving average won't work
Hi Bassam,
I did check that page, and the results of my query were equal to the
moving average quoted on that page (the table directly after the heading
"Moving Average--Perpetual").

>i will post DDL and some data here to clear the case
Excellent idea!
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||Hello Hugo,
I tested your statement, great , it works to a great detail !! , i found a
problem in the moving avg in date 2/22/05 , it should be exactly as the one
done on 12/18/04 (sales also) to be 26.5860 , but the one on 2/22/05 is
26.5920 (it is exactly 26.5860 in table) so i will make my tests what if i
put 20 sales transactions and see the result
but your statement gave max accurate to date to table.do you know a way to
overcome this small shift ?
thank you and welcome to any comments
Bassam|||On Mon, 7 Feb 2005 15:24:41 +0200, Bassam wrote:

>Hello Hugo,
>I tested your statement, great , it works to a great detail !! , i found a
>problem in the moving avg in date 2/22/05 , it should be exactly as the one
>done on 12/18/04 (sales also) to be 26.5860 , but the one on 2/22/05 is
>26.5920 (it is exactly 26.5860 in table) so i will make my tests what if i
>put 20 sales transactions and see the result
Hi Bassam,
I noted the difference as well. This is caused by rounding errors.
Consider the first few rows in the sample data. The beginning inventory
shows 200 units at a total cost of $ 5,000 - exactle $ 25.00 on average.
After the first purchase, there are 300 units on stock and the total cost
is equal to $ 7,600. The average price is $ 25.333333333333333 (etc), but
it is rounded down to $ 25.33. This would mean that if the following sale
would not be for 100 units (as listed in the example), but for 300 units,
the total sale price would be $ 7,599 and the remaining stock would be 0
units, for a total price of $ 1.
The example on the web page graciously avoids this anomaly by only
including a new price after each purchase. It doesn't list the moving avg
cost after a sale, so I could not verify if the values given by my query
are correct or not.
If you need the moving average cost to reflect the situation after the
last purchase instead of after the last sale, try this (slightly more
complicated) query:
SELECT a.OpDate AS InvDate,
SUM(b.Amount) AS Amount,
SUM(b.Amount * b.UnitPrice) AS Value,
(SELECT SUM(c.Amount * c.UnitPrice) / SUM(c.Amount)
FROM Operations AS c
WHERE c.OpDate <= (SELECT MAX(d.OpDate)
FROM Operations AS d
WHERE d.OpDate <= a.OpDate
AND d.Amount > 0)) AS MovingAvg
FROM Operations AS a
INNER JOIN Operations AS b
ON b.OpDate <= a.OpDate
GROUP BY a.OpDate
ORDER BY a.OpDate
(Note: if you only need the date and the moving average, not the amount
and value of the inventory, you can remove the group by and the join to
"Operations AS b" - IOW, you can simplify to:
SELECT a.OpDate AS InvDate,
(SELECT SUM(c.Amount * c.UnitPrice) / SUM(c.Amount)
FROM Operations AS c
WHERE c.OpDate <= (SELECT MAX(d.OpDate)
FROM Operations AS d
WHERE d.OpDate <= a.OpDate
AND d.Amount > 0)) AS MovingAvg
FROM Operations AS a
ORDER BY a.OpDate
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||Bassam,
Thanks to Hugo for posting the DDL for the table, I will assume it is
correct. Here is a try, but do not compare to the table in the link, there i
s
an error there.
Error in the link:
Sale, 12/18 (300) 26.58 (7,975)
well, -300 * 26.58 should be 7,974.
select
a.OpDate,
sum(b.Amount) as number_of_units,
sum(b.Amount * b.UnitPrice) as total_cost,
(
select
sum(c.Amount * c.UnitPrice) / sum(c.Amount)
from
Operations as c
where
c.OpDate <= (
select
max(d.OpDate)
from
Operations as d
where
sign(d.Amount) >= 0 and d.OpDate <= a.OpDate
)
) as moving_avg_cost
from
Operations as a
inner join
Operations as b
on a.OpDate >= b.OpDate
group by
a.OpDate
order by
a.OpDate
go
AMB
"Bassam" wrote:

> Hello Hugo,
> Thank you for your input but result of your statement will calculate
> "Weighted Average" not "Moving Average"
> difference is shown in examples in this link
> http://www.fms.indiana.edu/auxiliary/inventory.asp
> if you open this page and search for weighted average you fill find the
> example which works with your statement but the just below example which i
s
> for moving average won't work
> i will post DDL and some data here to clear the case
> Regards
> Bassam
>
> "Hugo Kornelis" <hugo@.pe_NO_rFact.in_SPAM_fo> wrote in message
> news:hhme01diqfdiohvb2rj3t896k5deoc47e9@.
4ax.com...
> calculate
> after
>
>|||Hello Hugo,
Thank you, Clear and efficient ! , only last problem , what if a user need
to delete a purchasing happened at beginning of month - or adjust its unit
price value, that means all next averages used in next sales is wrong and
need to be recalculated, is there a way to recalculate unit price for sales
transactions ' i need to adjust that before using your statement again or
result will be wrong
to make situation more complicated is that it might also be more purchasing
down there with sales, i mean suppose user deleted 1 of 5 purchasing done at
beginning of the month , on day 1 , while other purchasing happened on day 5
, 8 , 12 , 14 remains , and there are sales in between. , how then i can
recalculate unit price (which is the moving average) for sales
transactions.in between ?
Thank you
Bassam

Can the use of Shrinkfile break the Transaction Log chain?

My Log Shipping process has been up and running fine for about 6 months now.
Then as part of the preparation for upgrading the front end application for
the log shipped database, my partner DBA thought he would help the backup
speed by running a SHRINKFILE over the database files.
It was on or about this time that log shipping stopped working and reported
errors just like the ones you get when the transaction log has been
truncated. Basically it thinks the T Log chain has been broken.
Can SHRINKFILE break the chain? I thought it only compacted the unused file
space?
In my tests log shipping was not sensitive to shrinkfile statements. Perhaps
something else has gone wrong.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"GRP" <GRP@.discussions.microsoft.com> wrote in message
news:BD8BC1B6-FD32-43C2-B34E-7CA0397CAC35@.microsoft.com...
> My Log Shipping process has been up and running fine for about 6 months
now.
> Then as part of the preparation for upgrading the front end application
for
> the log shipped database, my partner DBA thought he would help the backup
> speed by running a SHRINKFILE over the database files.
> It was on or about this time that log shipping stopped working and
reported
> errors just like the ones you get when the transaction log has been
> truncated. Basically it thinks the T Log chain has been broken.
> Can SHRINKFILE break the chain? I thought it only compacted the unused
file
> space?
|||Hilary, thanks for taking the time to test this out. The only other
explanation I can think of is that the other DBA truncated the log prior to
the shrinkfile.
"Hilary Cotter" wrote:

> In my tests log shipping was not sensitive to shrinkfile statements. Perhaps
> something else has gone wrong.
> --
> Hilary Cotter
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
> "GRP" <GRP@.discussions.microsoft.com> wrote in message
> news:BD8BC1B6-FD32-43C2-B34E-7CA0397CAC35@.microsoft.com...
> now.
> for
> reported
> file
>
>

Sunday, March 11, 2012

Can SSRS use an ASP.NET dataset?

We find that quite often we have devoted a great deal of work in our asp.net
application to generate just the right dataset. Now we want to produce a
report from it. Is there any way just to pass our existing dataset to
reporting services instead of having to re-inquire, re-filter, re-join, etc?
thanks,
THI Tim,
> We find that quite often we have devoted a great deal of work in our
asp.net
> application to generate just the right dataset. Now we want to produce a
> report from it. Is there any way just to pass our existing dataset to
> reporting services instead of having to re-inquire, re-filter, re-join,
etc?
Yes, I have solved the same question.
I have implemented a custom RS DataExtension. The DataExtension use a
System.Data.Dataset as data source.
At report design time I use an XML file to load schema and sample data.
When I must cosume the report from my ASP.NET application I use
ReportingServices web service (render method) and I pass my dataset as
parameters... I pass dataset as XML String: your custom DataExtension must
be able to treat it.
The dataset must have a compatible schema with dataset you have used to
design report.
You can find a sample of DataExtension implementation in your folder
"C:\Program Files\Microsoft SQL Server\MSSQL\Reporting
Services\Samples\Extensions\FsiDataExtension".
HTH M.rkino
--
Marco Barzaghi - [MVP - MCP]
http://mvp.support.microsoft.com - http://italy.mvps.org
UGIDotNet - User Group Italiano .NET, http://www.ugidotnet.org
Read my WebLog: http://www.ugidotnet.org/436.blog|||Marco has a good solution if you must do it this way. But look at the hoops
to go through. First you have to write a data extension (although this could
be done just once). But then look at what you have to do with every report
you want to do. You have to have an xml defining the schema with some sample
data. This will definitely affect productivity in creating reports plus it
raises the skill level necessary to create reports. My feeling is that a
better direction to take is to put the logic into a stored procedure. If you
have code that ends up with a dataset in your asp application then someone
can easily look at it and create a stored procedure. I have been doing that
some when taking reports written in C. Although, when people work in
something like C, C#, VB they don't tend to solve the solution in a set
based manner so sometimes you are better off to totally rewrite the logic.
Anyway, once it is in a stored procedure then both your asp application and
RS can use it. RS supports stored procedures quite well (at least with SQL
Server, I have tried unsuccessfully with Sybase 11.x). My guess is the
effort to encapsulate the logic into a stored procedure will be no greater
than going through the hoops for a data extension. Once Yukon comes out then
this would be even easier to port your code to a stored procedure but for
now you would need to use T-SQL.
Now, in some cases you can not use a stored procedure easily in which case
Marco's solution is a very elegant one.
Bruce L-C
"Tim Seaburn" <tims@.removespamexcite.com> wrote in message
news:OIwXtK1WEHA.2852@.TK2MSFTNGP12.phx.gbl...
> We find that quite often we have devoted a great deal of work in our
asp.net
> application to generate just the right dataset. Now we want to produce a
> report from it. Is there any way just to pass our existing dataset to
> reporting services instead of having to re-inquire, re-filter, re-join,
etc?
> thanks,
> T
>

Can SSRS handle an "Invoice" application

Hello,

I am trying to create an invoice-like form in SSRS. I am trying to confirm whether this is possible or not, as when I use a table component to list the items, the total and any other text boxes underneath that table are pushed down as more items are added to the table at run time! I know this is the intended behavior by design, but I need to know if I can have a behavior that will not push the text boxes underneath the table - to support an ivoice-like form?

Your help is appreciated.

TF

Do not use the table control from the toolbox. Set the header and body sections, and use text boxes to build the invoice detail.

Thursday, March 8, 2012

Can SQL Server message other processes?

I'm a developer for a rich client application with a primary grid that should be refreshed when data is changed by other users. I loath to resort to some sort of polling. It would be really cool if there is a native way to raise an event on the client from a SQL Server trigger. RAISEERROR can send a message to the Connection's InfoMessage() event. But of course this will only send the message back to the user who made the change. Is there anyway in SQL Server to raise an error message on another process so that this ADO event can pick it up?

This is not possible without some elaborate engineering in SQL Server 2005 (even more so in SQL Server 2000). With SQL Server 2005, you can use service broker to do this. It is hard to tell without knowing more details but I suggest that you take a look at the new features in SQL Server 2005 and see if those address your needs.|||You could always use firebird/interbase. probably on of the best rdbms's around.

Other that that (hypotheticals follow)

in SQL 2000 ->
You could put a com+ object in DTS. Trigger on a data-change notifies the com+ object. COM+ object has list of registered clients that it notifies of the changes.

SQL 2005 it would be even easier with the integration of .NET

wouldn't that work?

Oh dont make me do this in VBSUX because VB, well vb simply sux - how did it become so successful?! I dont want to do it in VB.NET as I want to cater the lowest common denominator. And boy is VB the lowest denominator!

Simple to do in delphi! but give me an hour. . . I'll do it in VB
God delphi rox!|||Thanks for your help. I'm not suprised that there isn't anything. However I'm disapointed SQL Server 2005 doesn't have it. SQL Server has all the capabilities as a simply event conduit between it's clients. Kind of a waste then that some other messaging service is required for simple data related events to be passed around.
For an alternative I have an idea to referesh based on user activty. A few events will call a function and refresh if some criteria has been met. Eg the form is activated after five minutes.
|||

well trying to do it using vbsux further ingrained my disdain for the piece of sh|t that vb6 is. Its not hard to do in delphi. It is Actually rather simple.

About 20 lines of actual code you need to write. . .

Create an activeX exe (DBNotifier) that defines an object (NotifyClient) that implements the interface

INotifyClient
{
Notify()
}
with an event OnNotify

another singleton object (Manager) implements the interface -

IManager
{
void RegisterClient(INotifyClient client);
void UnRegisterClient(INotifyClient client);
void NotifyClients()
}
During the call to NotifyClients you need to synchronize access to a collection it contains that will hold references to the clients.

Finally an object that (NotifyAgent) implements
INotifyAgent
{
void Notify(long ID)
}
NotifyAgent calls the Managers.NotifyClients Method

In the GUI app, get a reference to the IManager Object, Instance An INotifyClient and register it. Define an OnNotifyEvent to do what ever you want.
Now in the database (I will use northwind for example) attach a trigger of this sort:
=============================

create trigger trig_employeesDataChange on northwind.dbo.employees for DELETE,INSERT,UPDATE
as
DECLARE @.object int
DECLARE @.hr int
DECLARE @.obj_ID int
DECLARE @.src varchar(255), @.desc varchar(255)
select @.obj_ID = ID from sysobjects o inner join
sysusers u on o.uid = u.uid
where
u.name ='dbo' and
o.name ='employees'

EXEC @.hr = sp_OACreate 'DBNotifier.Agent', @.object OUT
IF @.hr = 0
EXEC @.hr = sp_OAMethod @.object, 'Notify', NULL, @.obj_id
IF @.hr <> 0
BEGIN
EXEC sp_OAGetErrorInfo @.object, @.src OUT, @.desc OUT
SELECT hr=convert(varbinary(4),@.hr), Source=@.src, Description=@.desc
RETURN
END
=============================

Again. . . dont try in VBSUX, its not worth the effort use a real development environment. Why you might ask? The synchronization is impossible. VB is just a load of cr@.p (have they yet shot the guys who developed it? shoot their mothers too!!!)

Now. . . why is this not implemented natively? Well, because you aren't supposed to remain connected to the database. Its bad design!

Connect, get your data and get out!!!!
Connect, change your data and get out!!!!

|||You can do it using service broker and query notifications mechanisms in SQL Server 2005. It depends on your requirements. As I said, you should check out those features in Books Online.|||

Boy, I could complicate a wet dream!

Its not difficult at all, provided you use Delphi as you can't do it with VBSUX alone because VBSUX is a piece of cr@.p and cant create COM+ event objects. . . Have those guys been shot yet?

Total time of implementation 10 minutes depending on how many SQL objects you want sending notifications!!!

Three parts. . .

● Build, register and install a COM+ Event Object - SQLEvents (this is not hard but you cannot do it in VBSUX!!! Use Delphi!)
● Add triggers to your SQL objects that should initiate the SQLEvents
● Create an ActiveX Event Sink for handling the COM+ Events - SQLEventSink (This can be done in VBSUX!!!)
If you don't have delphi, go home - you suck!

[Part One - Looks like alot, but it takes all of 3 minutes!!!]
1. create a Delphi Active X library, Call it SQLEvents.
2. From the file menu - > Add >Other -> ActiveX -> Automation Object call it SQLEvent with Apartment Threading (no events)
3. From view Menu -> Type Library. . . In the the TypeLibrary editor, add a method to the ISQLEvent interface called Notify that takes a long parameter called SQLObject [see here]
4. Generate the code and call the generated pas file SQLEvents_impl.pas; you dont need to write ANY code!!!!!
5. From the Run Menu -> Register Active X Server (this also builds the DLL)

On the SQL Server machine:
6. Open Component Services and drill down to COM+ Applications. Right Click and select New -> Application - Next -> Empty Application Call it 'SQLEvents' and set Server Application as your activation type -> Applciation Identity Interactive User -> use the default application roles -> dont add any roles -> finish

7. Expand the SQLEvents Aplication folder to the Components folder and right click and select New -> Component -> Next -> Click Install New Event Class(es) and locate and open the SQLEvents.dll you built in step 5. -Next -> Finish

The event object is done. and the tree should look like this when expanded.

[Part 2]
8. Add triggers to the SQL Objects that need to send notifications -

NOTES: My build has a CLSID of "{8FD50E86-203D-4939-9CAE-0F2865C69465}" yours will be different! You can find it out by right clicking the Component installed in step 7 and selecting properties.
Also. this example uses northwind and will trigger events on Update Delete and Insert on the employees table:
=====================================================
CREATE trigger trig_employeesDataChange on northwind.dbo.employees for DELETE,INSERT,UPDATE
as
DECLARE @.object int
DECLARE @.hr int
DECLARE @.obj_ID int
DECLARE @.src varchar(255), @.desc varchar(255)
select @.obj_ID = ID from sysobjects o inner join
sysusers u on o.uid = u.uid
where
u.name ='dbo' and
o.name ='employees'

EXEC @.hr = sp_OACreate '{8FD50E86-203D-4939-9CAE-0F2865C69465}', @.object OUT
IF @.hr = 0
EXEC @.hr = sp_OAMethod @.object, 'Notify', NULL, @.obj_id
IF @.hr <> 0
BEGIN
EXEC sp_OAGetErrorInfo @.object, @.src OUT, @.desc OUT
SELECT hr=convert(varbinary(4),@.hr), Source=@.src, Description=@.desc
RETURN
END
=====================================================

Part 3 [you can use VB here, total time 2 minutes!!!]

9. Create a new VB ActiveX DLL Project, save it as SQLEventsSink, Rename Class1 to SQLEventsSink and save the file as SQLEventsSink.cls.

10. From the Projects menu Add a reference to the SQLEvents Lbrary you built in Step 5 above.

11. Add this code to SQLEventsSink:
=================================
Option Explicit
Implements SQLEvents.SQLEvent

Private mSQLObjectID As Long 'local copy
Public Event OnNotify()

Public Property Let SQLObjectID(ByVal vData As Long)
mSQLObjectID = vData
End Property

Public Property Get SQLObjectID() As Long
SQLObjectID = mSQLObjectID
End Property

Private Sub SQLEvent_Notify(ByVal SQLObjectID As Long)
If SQLObjectID = Me.SQLObjectID Then RaiseEvent OnNotify
End Sub
=================================

12. Build the Library and you are done. . . you have an event system!!!

Here's how to use ->

1. Create A New VB Application Project Call it TestApp
2. From the Project Menu, add references to MS Active Data Object 2.6 (minimum), COM+ Admin Library and the SQLEventSink library you built in step 12 above. In the Toolbox add the MS DataGrid 6.0
3. Add a Module, name it globals and add the following code
==============================================
Option Explicit

Public Const CONNECTIONSTRING = "Provider=SQLOLEDB.1;" & _
"Integrated Security=SSPI;Persist Security Info=False;" & _
"Initial Catalog=Northwind;Data Source=.\SQL2000"

' NOTE: CHANGE THE FOLLOWING TO REFLECT THE CLSID
' OF THE SQLEvents.SQLEvent OBJECT YOU PREVIOUSLY
' BUILT AND INSTALLED IN COM+

Public Const CLSID_SQLEVENT = "{8FD50E86-203D-4939-9CAE-0F2865C69465}"
==============================================

4. Add a Module, name it ComUtils and add the following code (funny, in delphi it only takes about 6 lines of code to accomplish the same!!! Have I mentioned that VBSUX, sucks?!?)
==============================================
' This method creates a Transient Subscription to a COM+ Component
' Refer to The Windows Platform SDK and Particularly ICOMAdminCatalog
' clsID is the COM+ Event Component to which you are subscribing
' objref is the subscriber
' hostname is the machine on which the COM+ Event Component is registered
' If empty, connection stays on local machine

Public Function CreateTransientSubscription( _
ByVal clsid As String, _
ByVal objref As Object, _
Optional ByVal hostName As String = "") As String
Dim oCOMAdminCatalog As COMAdmin.COMAdminCatalog
Dim oTSCol As COMAdminCatalogCollection
Dim oSubscription As ICatalogObject
Dim objvar As Variant
On Error GoTo CreateTransientSubscriptionError
Set oCOMAdminCatalog = CreateObject("COMAdmin.COMAdminCatalog")
'Connect to the
If hostName <> "" Then oCOMAdminCatalog.Connect hostName
'Gets the TransientSubscriptions collection
Set oTSCol = oCOMAdminCatalog.GetCollection( _
"TransientSubscriptions")
Set oSubscription = oTSCol.Add
Set objvar = objref
oSubscription.Value("SubscriberInterface") = objref
oSubscription.Value("EventCLSID") = clsid
oSubscription.Value("Name") = "TransientSubscription"
oTSCol.SaveChanges
CreateTransientSubscription = oSubscription.Value("ID")
Set oSubscription = Nothing
Set oTSCol = Nothing
Set oCOMAdminCatalog = Nothing
Set objvar = Nothing
Exit Function
CreateTransientSubscriptionError:
CreateTransientSubscription = ""
Err.Raise Err.Number, "[CreateTransientSubscription]" & _
Err.Source, Err.Description
End Function
==============================================

5. Drop a DataGrid control on your form leaving the properties as their defaults. Add a Timer to the form as you need it because VBSUX does not natively support multi-threading. . . Have I told you how much VBSUX sucks? It really does! I wouldn't lie to you!

6. In the Form1 code add the following:
=========================================

Option Explicit
Private WithEvents mSink As SQLEventSink

Private Sub Form_Load()
Set mSink = New SQLEventSink
CreateTransientSubscription _
"{8FD50E86-203D-4939-9CAE-0F2865C69465}", _
mSink
LoadGrid
End Sub

Private Sub mSink_OnNotify()
Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
Timer1.Enabled = False
LoadGrid
End Sub

Private Sub LoadGrid()
Dim con As Connection
Set con = New ADODB.Connection
con.Open CONNECTIONSTRING
If DataGrid1.DataSource Is Nothing Then
With con.Execute("SELECT ID FROM SYSOBJECTS O " & _
" INNER JOIN SYSUSERS U ON O.UID = U.UID " & _
" WHERE U.NAME = 'DBO' and O.NAME = 'EMPLOYEES'")
mSink.SQLObjectID = .Fields(0)
.Close
End With
End If
Dim rst As Recordset
Set rst = New Recordset
rst.CursorLocation = adUseClient
Set rst.ActiveConnection = con
rst.Open "SELECT * FROM EMPLOYEES"
Set rst.ActiveConnection = Nothing
con.Close
Set DataGrid1.DataSource = rst
Set con = Nothing
Set rst = Nothing
End Sub
=========================================

7. Run the app -
if your Northwind has not been changed, the name for employeeID 7 should be: King, Robert.

In SQL Query Analyzer, execute:

update employees set FirstName = 'Stephen' where EmployeeID = 7

and "voila!!!" Stephen King automatically appears in your datagrid!!!

References:
ICOMAdminCatalog
Registering a Transient Subscription

Complete Source Code can be found here. Zip also contains a compiled SQLEvents.dll,, just in case you don't have delphi and are still hanging around!

|||1. Don't implement the sink in VBSUX as the VBSUX com object is unstable.
No problems with a sink implemented in delphi. Have I told you that VBSUX is a total piece of CR@.P?

2. You need to enter a critical immediately upon entering the handler. After entering the critical section, null the Sink reference. Reinitialize the sink right after make changes inside the thread that does the response to the notification. So Don't Implement a Sink Client in VBSUX because Critical sections in VBSUX are a total pain in the @.SS - and threads in VBSUX are even worse!!! Have I told you that VBSUX is a PIECE OF CR@.P?

3. Best perfromance is not kicking the COM+ event off in the sql server but in the applciation that makes the change to the database. Immediately after making a change you want to publish, instance a COM+ Event and call Notify.

On a 2.6 P4 H/T w 775mb mem, I had 22 publishers notifying 30 subscribers. . .slow but no blow-ups.

Can SQL Server Make A call to a Windows Service?

I have an application which needs to be able to use our local SQL server
database to get data (go figure, what else would it do right?). When the
data being sought is NOT in the database I need to be able to connect to a
MySQL database which is located... oh maybe 1500km. from here.
I use a Windows Service to do some time based updates from this remote site
already. I would like to be able to have the process work like this:
SQL server does lookup.
Data does not exist.
SQL server calls Windows Service to update database.
Windows Service Updates tables and makes data available.
Can I do this?
Does it matter that the windows service is running on .Net?
The firewall rules dictate that we can get data from them, but they cannot
push data to us. Since the transfer medium is the Internet I don't want the
SQL server to talk directly to the remote server. (I want to keep that
access closed).
Thanks.Am Wed, 16 Nov 2005 11:10:44 -0500 schrieb Roger Twomey:

> I have an application which needs to be able to use our local SQL server
> database to get data (go figure, what else would it do right?). When the
> data being sought is NOT in the database I need to be able to connect to a
> MySQL database which is located... oh maybe 1500km. from here.
> I use a Windows Service to do some time based updates from this remote sit
e
> already. I would like to be able to have the process work like this:
> SQL server does lookup.
> Data does not exist.
> SQL server calls Windows Service to update database.
.. till here no problems, You can do all this

> Windows Service Updates tables and makes data available.
> Can I do this?
> Does it matter that the windows service is running on .Net?
> The firewall rules dictate that we can get data from them, but they cannot
> push data to us. Since the transfer medium is the Internet I don't want th
e
> SQL server to talk directly to the remote server. (I want to keep that
> access closed).
> Thanks.
You are still not complete safe. Because somebody could capture the data
transfered from MySQL to SQL-Server, change it and send it to SQL-Server.
The only safe way would be VPN or SSL.
bye,
Helmut|||If you're using SQL2005 you can create a .net stored proc to call the
windows service.
If you're using SQL2000 you'll need to create a COM wrapper for the .NET
call.
research into: sp_OACreate, sp_OADestroy, sp_OAMethod, sp_OAGetProperty.
etc.
Thanks,
- Becky
"Roger Twomey" <rogerdev@.vnet.on.ca> wrote in message
news:uuQXkis6FHA.4076@.tk2msftngp13.phx.gbl...
> I have an application which needs to be able to use our local SQL server
> database to get data (go figure, what else would it do right?). When the
> data being sought is NOT in the database I need to be able to connect to a
> MySQL database which is located... oh maybe 1500km. from here.
> I use a Windows Service to do some time based updates from this remote
site
> already. I would like to be able to have the process work like this:
> SQL server does lookup.
> Data does not exist.
> SQL server calls Windows Service to update database.
> Windows Service Updates tables and makes data available.
> Can I do this?
> Does it matter that the windows service is running on .Net?
> The firewall rules dictate that we can get data from them, but they cannot
> push data to us. Since the transfer medium is the Internet I don't want
the
> SQL server to talk directly to the remote server. (I want to keep that
> access closed).
> Thanks.
>|||IIS allows free https setup. Do you think that would make this person
secure?

> Am Wed, 16 Nov 2005 11:10:44 -0500 schrieb Roger Twomey:
>
> .. till here no problems, You can do all this
>
> You are still not complete safe. Because somebody could capture the data
> transfered from MySQL to SQL-Server, change it and send it to SQL-Server.
> The only safe way would be VPN or SSL.
> bye,
> Helmut
new|||I don't know if you are a C++ programmer. If you are then you'll want to
research into extended stored procedures. We use this for WinInet/Winsock
communications as well as http/ftp and many other uses. Very powerful, very
fast, very dangerous if you don't know what you are doing.

> I have an application which needs to be able to use our local SQL server
> database to get data (go figure, what else would it do right?). When the
> data being sought is NOT in the database I need to be able to connect to a
> MySQL database which is located... oh maybe 1500km. from here.
> I use a Windows Service to do some time based updates from this remote
> site already. I would like to be able to have the process work like this:
> SQL server does lookup.
> Data does not exist.
> SQL server calls Windows Service to update database.
> Windows Service Updates tables and makes data available.
> Can I do this?
> Does it matter that the windows service is running on .Net?
> The firewall rules dictate that we can get data from them, but they cannot
> push data to us. Since the transfer medium is the Internet I don't want
> the SQL server to talk directly to the remote server. (I want to keep that
> access closed).
> Thanks.
new|||We don't have IIS on our SQL servers. We try to keep each server to a single
purpose, then secure it as much as we can.
"beginthreadex" <beginthreadex@.hotmail.com> wrote in message
news:OK0wyOt6FHA.2600@.tk2msftngp13.phx.gbl...
> IIS allows free https setup. Do you think that would make this person
> secure?
>
> --
> new|||I most definately am NOT a c++ programmer. I use vb.Net primarily.
Maybe some day I will get into C++, but only if there is a need. My brain is
pretty much full already!
;)
"beginthreadex" <beginthreadex@.hotmail.com> wrote in message
news:%23TKEtPt6FHA.2600@.tk2msftngp13.phx.gbl...
>I don't know if you are a C++ programmer. If you are then you'll want to
> research into extended stored procedures. We use this for WinInet/Winsock
> communications as well as http/ftp and many other uses. Very powerful,
> very
> fast, very dangerous if you don't know what you are doing.
>
> --
> new|||Thanks for the suggestion. I think your answer sounds the most promising,
and the most re-useable. There could be many other uses for the knowlege
once I have it.
Thanks.
"Rebecca York" <rebecca.york {at} 2ndbyte.com> wrote in message
news:437b60ce$0$138$7b0f0fd3@.mistral.news.newnet.co.uk...
> If you're using SQL2005 you can create a .net stored proc to call the
> windows service.
>
> If you're using SQL2000 you'll need to create a COM wrapper for the .NET
> call.
> research into: sp_OACreate, sp_OADestroy, sp_OAMethod,
> sp_OAGetProperty.
> etc.
>
> Thanks,
> - Becky
>
> "Roger Twomey" <rogerdev@.vnet.on.ca> wrote in message
> news:uuQXkis6FHA.4076@.tk2msftngp13.phx.gbl...
> site
> the
>

Wednesday, March 7, 2012

Can SQL Server 2005 Evaluation be used to upgrade a system?

I have multiple development SQL Servers running Enterprise edition that I want to upgrade for application testing before upgrading our production system. All of the servers meet the hardware and software requirements for SQL Server 2005 Enterprise edition. However, when I try to install to use the SQL Server 2005 Evaluation Edition to upgrade the servers in place, I get the blocked upgrade message:

Name: Microsoft SQL Server 2000 Reason: Your upgrade is blocked. For more information about upgrade support, see the "Version and Edition Upgrades" and "Hardware and Software Requirements" topics in SQL Server 2005 Setup Help or SQL Server 2005 Books Online. Edition check: Your upgrade is blocked because of edition upgrade rules. For more information about edition upgrades, see the Version and Edition Upgrades topic in SQL Server 2005 Setup Help or SQL Server 2005 Books Online.

Can the Evaluation Edition be used to upgrade these servers or do you need the full blown version?

thanks

Sorry, upgrades are prohibited *to* the Eval edition.|||I am getting this error now myself and I don't know why. I installed the trial SQL Server Express for my boss. He then asked if I would install the trial SQL Server 2005 becuase it has more capabilities he would like to try out. So I installed 2005. He noticed that there was no management studio installed and needed. So I uninstalled it and am trying to reinstall it and am getting this error. I haven't even used the software yet! I don't know what to do!|||

I was able to continue the installation but just before I click OK to install, I see this in a window

The following components that you selected will not be changed:

Client Components

that might be why I had my original problem. That problem was the Management Studio was never installed which prompted me to reinstall the system alltogether thinking I must have not checked that installation option.

Ahh!!!

Can SQL Server 2005 Evaluation be used to upgrade a system?

I have multiple development SQL Servers running Enterprise edition that I want to upgrade for application testing before upgrading our production system. All of the servers meet the hardware and software requirements for SQL Server 2005 Enterprise edition. However, when I try to install to use the SQL Server 2005 Evaluation Edition to upgrade the servers in place, I get the blocked upgrade message:

Name: Microsoft SQL Server 2000

Reason: Your upgrade is blocked. For more information about upgrade support, see the "Version and Edition Upgrades" and "Hardware and Software Requirements" topics in SQL Server 2005 Setup Help or SQL Server 2005 Books Online.

Edition check:

Your upgrade is blocked because of edition upgrade rules. For more information about edition upgrades, see the Version and Edition Upgrades topic in SQL Server 2005 Setup Help or SQL Server 2005 Books Online.

Can the Evaluation Edition be used to upgrade these servers or do you need the full blown version?

thanks

Sorry, upgrades are prohibited *to* the Eval edition.|||I am getting this error now myself and I don't know why. I installed the trial SQL Server Express for my boss. He then asked if I would install the trial SQL Server 2005 becuase it has more capabilities he would like to try out. So I installed 2005. He noticed that there was no management studio installed and needed. So I uninstalled it and am trying to reinstall it and am getting this error. I haven't even used the software yet! I don't know what to do!|||

I was able to continue the installation but just before I click OK to install, I see this in a window

The following components that you selected will not be changed:

Client Components

that might be why I had my original problem. That problem was the Management Studio was never installed which prompted me to reinstall the system alltogether thinking I must have not checked that installation option.

Ahh!!!

Can SQL server 2000 Enterprise Edition run in Windows XP?

Please help me here...I am a new user of sql server 2000 and a beginner in asp...We are making a web application and I have some problems with sql server 2000 in my windows XP.

1. I'm not connected in a network.
2. When I try to connect to sql server 2000 using this code:
<%
Dim CN
Dim RS
Set CN=Server.CreateObject("ADODB.Connection")
CN.Open "Provider=SQLOLEDB.1;uid=sa;Initial Catalog=Planetchow;"
Set RS = CN.Execute ("SELECT Restaurant_Id FROM RestaurantInfo")

While Not RS.EOF
Response.Write "<TR>"
Response.Write "<TD>" & RS.Fields("Restaurant_Id") & "</TD>"
Response.Write"</TR>"
RS.MoveNext
Wend
%>

I get this error message:

"Error Type:
Microsoft OLE DB Provider for SQL Server (0x80004005)
Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection."

3. How come? What configurations do I have to make to be able to avoid this...

4. How do I connect to SQL server 2000 in ASP vbscript code?

Please I really need some help here...thank you!Go to enterprise manager and right click on the server and select properties then go to the tab that says security and make sure "SQL Server and Windows" is checked.

Can SQL keep up

OK, here is my quandary...
I have an application that needs a database to collect a
LARGE amount of research data. This application arranges
up to 200 "bodies" in a 3 dimensional space and basically
collects "telemetry" from them as they move around.
This "telemetry" comprises somewhere in the neighborhood
of 1400 data elements. This application would "feed" this
to the db at 20Hz over the period of an hour or so.
So basically, every 20th of a second, up to 200 records
would be written, each record would contain approx. 1400
fields. A 1 hour "engagement" would write some 14.4
million records. (20 (writes per second) * 3600 (seconds
per hour) * 200 (bodies))
Given SQL Server 2000 has a 1024 column limit, I will need
to break this data down into several normalized tables,
not a problem, should be done anyway I imagine. Here's my
question. Can SQL Server 2000 keep up, if the machine and
drive's are robust enough to handle the I/O '
Any and all help or, advice is greatly appreciated !!
MichaelThanks Joe ! It does sound like it should function,
unfortunately I don't have any idea of the fields or sizes
yet. So I'm not sure of the row sizes.
I did bookmark the site, and will take a look. Will you be
published there after the conference ?
>--Original Message--
>i can do ~7,000 single row inserts/sec with one insert
>statement per stored procedure call on a 2x2.4GHz Xeon
>server. This is a small table ~12 columns, avg size
>80bytes/row.
>By consolidating multiple single row insert statements
per
>stored procedure, i can insert > 18K rows/sec.
>By inserting multiple rows per statement, >29K row/sec.
>In our case, it sounds like you may have to insert into
>more than one table to accommodate 1400 fields.
Otherwise,
>I do not expect the larger size per row in bytes or
>columns to significantly increase the cost of the insert.
>i will talk on this subject at the fall SQL Server
>Magazine Connections conference (Oct 12-15) ,
>www.sqlconnections.com , if you are interested in more
>material
>
>>--Original Message--
>>OK, here is my quandary...
>>I have an application that needs a database to collect a
>>LARGE amount of research data. This application arranges
>>up to 200 "bodies" in a 3 dimensional space and
basically
>>collects "telemetry" from them as they move around.
>>This "telemetry" comprises somewhere in the neighborhood
>>of 1400 data elements. This application would "feed"
this
>>to the db at 20Hz over the period of an hour or so.
>>So basically, every 20th of a second, up to 200 records
>>would be written, each record would contain approx. 1400
>>fields. A 1 hour "engagement" would write some 14.4
>>million records. (20 (writes per second) * 3600 (seconds
>>per hour) * 200 (bodies))
>>Given SQL Server 2000 has a 1024 column limit, I will
>need
>>to break this data down into several normalized tables,
>>not a problem, should be done anyway I imagine. Here's
my
>>question. Can SQL Server 2000 keep up, if the machine
and
>>drive's are robust enough to handle the I/O '
>>Any and all help or, advice is greatly appreciated !!
>>Michael
>>.
>.
>|||On Wed, 13 Aug 2003 12:38:40 -0700, "Michael" <Mykliv@.hotmail.com>
wrote:
>Given SQL Server 2000 has a 1024 column limit, I will need
>to break this data down into several normalized tables,
>not a problem, should be done anyway I imagine. Here's my
>question. Can SQL Server 2000 keep up, if the machine and
>drive's are robust enough to handle the I/O '
Probably not a good idea to try to write the stuff in realtime.
Probably some version of buffering the data to an ascii file, then
doing a bulk-load of the records every minute or ten, is a better
architecture (there was a similar thread to this on the newsgroups
recently ... or was that you?).
Another data architecture option is to store sets of data as blobs,
that SQLServer will fetch but does not really understand the structure
of. This is often appropriate for spacial and/or realtime apps. This
can drastically reduce the work SQLServer does inserting and selecting
data, but with a lack of flexibility and power, of course.
J.|||Thanks Bill. The machine will most likely be a 2x3 GHz
Xeon with amble memory. I will look into the Tigi
accelerators you mentioned, thanks !
I did figure that I/O was going to be an issue, but I
wanted to be sure SQL could handle the load before I
started down that road.
I am after all looking at writing some 2.016 Trillion
fields an hour here.
Thanks for your advice, your help and your input !
Michael.
>--Original Message--
>Michael,
>SQL will not be an issue here. That many transactions
with that large amount
>of data should not use an inordinate amount of processor
or memory. A dual
>Xeon processor with 2 GB memory should be more than
adequate. However, your
>bottleneck will be very significant - physical disk I/O.
>Make sure you are using advanced physical storage
techniques. You'll need to
>stripe a lot of drives together and mirror them if you
need the redundency.
>Use partitioned views across different RAID partitions if
you need to.
>Also, a SAN technology with a large write buffer will
help a lot. If you
>have the budget look at solid state accelerators such as
Tigi:
>http://www.tigicorp.com/.
>Once you've determined you size requirements, you'll be
able to calculate
>your disk I/O throughput requirements.
>One more thing, look into using MSMQ (farmed across
multiple servers) to
>level the load going into SQL Server.
>Hope this helps.
>Bill
>"Michael" <Mykliv@.hotmail.com> wrote in message
>news:02e201c361d2$7f707a10$a501280a@.phx.gbl...
>> OK, here is my quandary...
>> I have an application that needs a database to collect a
>> LARGE amount of research data. This application arranges
>> up to 200 "bodies" in a 3 dimensional space and
basically
>> collects "telemetry" from them as they move around.
>> This "telemetry" comprises somewhere in the neighborhood
>> of 1400 data elements. This application would "feed"
this
>> to the db at 20Hz over the period of an hour or so.
>
>.
>

Saturday, February 25, 2012

Can someone solve this?

Hi,
I am trying to create a local report that retrieves the data from a web
service in my business layer application but I can't figure out how to get
this dataset into my report.
Here is what I do:
I have 3 projects in my solution:
Project1.
A class library which contains a typed dataset 'myTypedDataSet'.
Project2.
A web service application with one method that returns 'myTypedDataSet'
Project3.
A windows application that contains one form and one report.
- I open my report in the designer
- Added a new datasource based on my webservice method (and 'myTypedDataSet'
showed up in the data source explorer view)
- I added the fields from 'myDataSet' to my report.
- I created a button with a click event where I call my web service that
returns an object of 'myTypedDataSet'.
Now - how can I assign this dataset to the report? I can't see anything
documented about how to do this.
Kind Regards
ThomasAhh, this is different than I thought you were asking. The thread
2005 SQL Reporting Service XML Data Source (WebService)
talks about using a web service as a source for a server based report. Your
question really has nothing to do with a web service, rather if I understand
you correctly you are wanting to use the Winform control and give it the
dataset. I have just started using this control but so far in server mode. I
know that the way the control works in local mode is you give it the dataset
and the report to use. If no one answers I suggest posting with the subject:
How do you assign dataset for Winform Control
--
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Thomas Andersson" <1qa2ws3ed4rf5tg6yh@.newsgroup.nospam> wrote in message
news:8B4AD63D-6CF0-4BCB-A3E0-0B1EDE447659@.microsoft.com...
> Hi,
> I am trying to create a local report that retrieves the data from a web
> service in my business layer application but I can't figure out how to get
> this dataset into my report.
> Here is what I do:
> I have 3 projects in my solution:
> Project1.
> A class library which contains a typed dataset 'myTypedDataSet'.
> Project2.
> A web service application with one method that returns 'myTypedDataSet'
> Project3.
> A windows application that contains one form and one report.
> - I open my report in the designer
> - Added a new datasource based on my webservice method (and
> 'myTypedDataSet'
> showed up in the data source explorer view)
> - I added the fields from 'myDataSet' to my report.
> - I created a button with a click event where I call my web service that
> returns an object of 'myTypedDataSet'.
> Now - how can I assign this dataset to the report? I can't see anything
> documented about how to do this.
> Kind Regards
> Thomas|||Hi Bruce,
> I have just started using this control but so far in server mode. I
> know that the way the control works in local mode is you give it the dataset
> and the report to use.
But how do you do this in runtime with a dataset retrieved from a web
service? This must be a very common scenarion when you use the report in
local mode.
Actually - I have implemented a solution that does this but I am not happy
with the way I do it.
On my winform button click event:
//Create an inctance of my web service proxy class and get the dataset
wsASPService myService = new wsASPService();
DataSet ds = myService.GetSalesName();
//Loop through the records of the first tables in the returned dataset and
add those
//records to my report's dataset 'dsSalesName'
//('dsSalesName' is a dataset created in this winform project)
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
dsSalesName.Tables[0].Rows.Add(ds.Tables[0].Rows[i].ItemArray[0],
ds.Tables[0].Rows[i].ItemArray[1]); //Only 2 columns in my table
reportViewer2.Refresh();
This works ok but in this solution I have created my typed dataset in my win
forms project and this is a poor design. I want to keep this dataset in a
separate project so I can share my typed dataset definitions to be used
across my solution (see my first post in this thread where I have the dataset
in a class library project).
Any ideas?
Thanks
Thomas Andersson|||I would not think you should have to copy from one dataset to another. I
would think you could just set the data source for the control to this
dataset.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Thomas Andersson" <1qa2ws3ed4rf5tg6yh@.newsgroup.nospam> wrote in message
news:D78561C5-D531-409D-93EB-48AAFBA386CD@.microsoft.com...
> Hi Bruce,
>> I have just started using this control but so far in server mode. I
>> know that the way the control works in local mode is you give it the
>> dataset
>> and the report to use.
> But how do you do this in runtime with a dataset retrieved from a web
> service? This must be a very common scenarion when you use the report in
> local mode.
> Actually - I have implemented a solution that does this but I am not happy
> with the way I do it.
> On my winform button click event:
> //Create an inctance of my web service proxy class and get the dataset
> wsASPService myService = new wsASPService();
> DataSet ds = myService.GetSalesName();
> //Loop through the records of the first tables in the returned dataset and
> add those
> //records to my report's dataset 'dsSalesName'
> //('dsSalesName' is a dataset created in this winform project)
> for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
> dsSalesName.Tables[0].Rows.Add(ds.Tables[0].Rows[i].ItemArray[0],
> ds.Tables[0].Rows[i].ItemArray[1]); //Only 2 columns in my table
> reportViewer2.Refresh();
> This works ok but in this solution I have created my typed dataset in my
> win
> forms project and this is a poor design. I want to keep this dataset in a
> separate project so I can share my typed dataset definitions to be used
> across my solution (see my first post in this thread where I have the
> dataset
> in a class library project).
> Any ideas?
> Thanks
> Thomas Andersson|||> I would not think you should have to copy from one dataset to another. I
> would think you could just set the data source for the control to this
> dataset.
I get this error message when I try to do that: "Value does not fall within
the expected range."
wsASPService myService = new wsASPService();
DataSet ds = myService.GetSalesName();
reportViewer2.LocalReport.DataSources[0] = new
Microsoft.Reporting.WinForms.ReportDataSource("dsSalesName", ds);
Is this the right way of doing it? Can you get it to work if you do a quick
sample?
Kind Regards
Thomas|||Hi Thomas,
You may use the code like below
reportViewer.LocalReport.DataSources.Add(
new ReportDataSource("DataSet1_Orders", LoadOrdersData()));
LocalReport.SubreportProcessing Event
http://msdn2.microsoft.com/en-us/library/microsoft.reporting.winforms.localr
eport.subreportprocessing.aspx
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||Got it to work. First, the datasource needs to be a table, not a dataset
(remember, datasets can have multiple tables).
Here is working code (in my case I have a dataset with a single table that
gets the data from Sybase, doesn't matter though, works the same once you
have a dataset).
Dim dsReport As New Microsoft.Reporting.WinForms.ReportDataSource()
dsReport.Value = ds.Tables(0) 'ds is your dataset
dsReport.Name = "DatasourcenameYourReport is expecting"
Me.ReportViewer1.LocalReport.DataSources.Add(dsReport)
Me.ReportViewer1.RefreshReport()
If you add it by the wrong datasource name the reportviewer will tell you.
If you are not sure of the datasource name then add a break point and use
this in immediate window:
?me.ReportViewer1.LocalReport.GetDataSourceNames(0).ToString
--
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Thomas Andersson" <1qa2ws3ed4rf5tg6yh@.newsgroup.nospam> wrote in message
news:A6EFD849-F73F-4435-A7FF-118319B16449@.microsoft.com...
>
>> I would not think you should have to copy from one dataset to another. I
>> would think you could just set the data source for the control to this
>> dataset.
> I get this error message when I try to do that: "Value does not fall
> within
> the expected range."
> wsASPService myService = new wsASPService();
> DataSet ds = myService.GetSalesName();
> reportViewer2.LocalReport.DataSources[0] = new
> Microsoft.Reporting.WinForms.ReportDataSource("dsSalesName", ds);
> Is this the right way of doing it? Can you get it to work if you do a
> quick
> sample?
> Kind Regards
> Thomas

Can someone see whats wrong...??

I have a SQL query in my asp.net & c# application. im trying to retrieve the data from two tables where the ID's of the tables match. once this is found i am obtaining the value associated with one of the keys. e.g. my two tables

Event EventCategoryType

Field Type Example Field Type Example
EventID Int(4) 1 CategoryID(PK)int(4) 1
CategoryID(FK)int(4) 1 Type varchar(50) Exercise
Type varchar (200) Exercise Color varchar(50) Brown

The CategoryID is a 1:n relationship. my SQL query will retrive the values where the CategoryIDs match and the Tyoe matches as well. once this is found it will apply the associated color with that categoryID (each unique category has its own Color).

my application will read all the data correctly (ive checked it with a breakpoint too and it reads all the different colors for the different ID's) but it wont display the text in the right color from the table. it will just display everything in the first color it comes across.

Im including my code if it helps. can anyone tell me where i am going wrong please?? (the procedures are called on the On_Page_Load method)

private

void Load_Events()
{
///<summary>
///Loads the events added from the NewEvent from into a dataset
///and then just as with the Holidyas, the events are wriiten to
///the appropriate calendar cell by comparing the date. only the
///title and time will be displayed in the cell. other event details
///such as, Objective, owner will be shown in a dialog box syle when
///the user hovers over the event.
///</summary>

mycn =new SqlConnection(strConn);
myda =new SqlDataAdapter("SELECT * FROM Event, EventTypeCategory WHERE Event.CategoryID = EventTypeCategory.CategoryID AND Event.Type = EventTypeCategory.CategoryType", mycn);
myda.Fill(ds2, "Events");
}

privatevoid Populate_Events(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
{
///<summary>
///This procedure will read all the data from the dataset - Events and then
///write each event to the appropriate calendar cell by comparing the date of
///the EventStartDate. if an event is found, the title and time are written
///to the cell, other details are shown by hovering over the cell to bring
///up another function that will display the data in a dialogBox. once the
///event is written, the appropriate color is applied to the text.
///</summary
if (!e.Day.IsOtherMonth)
{
foreach (DataRow drin ds2.Tables[0].Rows)
{
if ((dr["EventStartDate"].ToString() != DBNull.Value.ToString()))
{
DateTime evStDate = (DateTime)dr["EventStartDate"];
string evTitle = (string)dr["Title"];
string evStTime = (string)dr["EventStartTime"];
string evEnTime = (string)dr["EventEndTime"];
string evColor = (string)dr["CategoryColor"];

if(evStDate.Equals(e.Day.Date))
{
e.Cell.Controls.Add(new LiteralControl("<br>"));
e.Cell.Controls.Add(new LiteralControl("<FONT COLOR = evColor>"));
e.Cell.Controls.Add(new LiteralControl(evTitle + " " + evStTime + " - " + evEnTime));
}
}
}
}
else
{
e.Cell.Text = "";
}
}

e.Cell.Controls.Add(new LiteralControl("<FONT COLOR = " + evColor + ">"));

does that solve the problem ?

|||

Fantastic! works perfectly! Thanks!

Friday, February 24, 2012

Can someone clarify why only a single-statement can be executed in a command?

I'm evaluating SQL 2005 Everywhere Edition for use by our desktop application. I'm a traditional SQL Server developer and I rely heavily on stored-procedures to encapsulate basic data manipulations across multiple tables and inside multi-statement transactions.

I was excited to see an in-process version of SQL released and my thought was "this is great... now I can ditch the tediousness of individual OLEDB/.NET commands, and write batches of T-SQL and just focus on the data manipulations". But, alas, it seems I cannot. Why is SQL Everywhere Edition limited to executing a single SQL statement at a time?

For example, my application would like to update mutlipe rows in one table, delete multiple rows from another, and insert multiple rows into a third. I can do that with 3 T-SQL statements in a single small batch in a very readable way with full blown SQL Server. (and I can put that batch in a stored procedure and re-use it efficiently later.) If I contemplate how to do that with OLEDB and the single statement limitation of SQL Everywhere, it's a lot more code and a lot less appealing/maintainable. I want as much of my app to be using declarative code and as little as possible tied up in tedious OLEDB calls. Is this not possible with SQL Everywhere Edition?

Have you tried it at all?

From my understanding alot of database servers limited the execution of multiple sql statements because you would end up with people doing stuff like "select * from tablename where column='" + value + "'" and then you would have people that would inject sql into value and they sould turn it into value ='"; DELETE * FROM TABLENAME ".

I think in most cases where multiple statements are executed - perhaps you can use joins? I'm really not sure. For the most part I try to use stored procedures where necessary - But that's just my personal preference. Hope this hielps.|||

I haven't tried, but the documentation (Mobile Edition Books Online) seems pretty clear:

The data provider for SQL Server Mobile has the following limitations:

No support for batch queries. Queries must be a single SQL statement. For example, the following statement is valid:

Copy Code

SELECT * FROM Customers

This statement is not valid:

Copy Code

SELECT * FROM Customers; SELECT * FROM Customers2

|||Right but its not the fact that you will use it - its the fact that many people wouldn't.

IMHO if you need to use batched sql statemnents that are reliant on a state of the prior sql statement you should use stored procedures. (unless of course it isn't supported)|||

Hi MarcD & Shaun,

I would like to clarify the positioning of SQL Server Everywhere Edition (SSEv) against other Microsoft SQL Server products such as SQL Server Standard/Enterprise Edition (SQL EE), SQL Server Express Edition (SQL XE).

SSEv is for small apps where you need basic data store and querying capabilities and not stored procs, sql batching ... etc. If you need these rich/advanced capabilities we would recommend you to use SQL XE.

SSEv is not a redundant product when compared to SQL XE. Each caters to different customer needs.

I hope I have not disappointed you by this post but thats the detail I can give for now :(

Thanks,

Laxmi Narsimha Rao ORUGANTI, SQL Server Everywhere, Microsoft Corporation

Can someone clarify why only a single-statement can be executed in a command?

I'm evaluating SQL 2005 Everywhere Edition for use by our desktop application. I'm a traditional SQL Server developer and I rely heavily on stored-procedures to encapsulate basic data manipulations across multiple tables and inside multi-statement transactions.

I was excited to see an in-process version of SQL released and my thought was "this is great... now I can ditch the tediousness of individual OLEDB/.NET commands, and write batches of T-SQL and just focus on the data manipulations". But, alas, it seems I cannot. Why is SQL Everywhere Edition limited to executing a single SQL statement at a time?

For example, my application would like to update mutlipe rows in one table, delete multiple rows from another, and insert multiple rows into a third. I can do that with 3 T-SQL statements in a single small batch in a very readable way with full blown SQL Server. (and I can put that batch in a stored procedure and re-use it efficiently later.) If I contemplate how to do that with OLEDB and the single statement limitation of SQL Everywhere, it's a lot more code and a lot less appealing/maintainable. I want as much of my app to be using declarative code and as little as possible tied up in tedious OLEDB calls. Is this not possible with SQL Everywhere Edition?

Have you tried it at all?

From my understanding alot of database servers limited the execution of multiple sql statements because you would end up with people doing stuff like "select * from tablename where column='" + value + "'" and then you would have people that would inject sql into value and they sould turn it into value ='"; DELETE * FROM TABLENAME ".

I think in most cases where multiple statements are executed - perhaps you can use joins? I'm really not sure. For the most part I try to use stored procedures where necessary - But that's just my personal preference. Hope this hielps.

|||

I haven't tried, but the documentation (Mobile Edition Books Online) seems pretty clear:

The data provider for SQL Server Mobile has the following limitations:

No support for batch queries. Queries must be a single SQL statement. For example, the following statement is valid:

Copy Code SELECT * FROM Customers

This statement is not valid:

Copy Code SELECT * FROM Customers; SELECT * FROM Customers2

|||Right but its not the fact that you will use it - its the fact that many people wouldn't.

IMHO if you need to use batched sql statemnents that are reliant on a state of the prior sql statement you should use stored procedures. (unless of course it isn't supported)
|||

Hi MarcD & Shaun,

I would like to clarify the positioning of SQL Server Everywhere Edition (SSEv) against other Microsoft SQL Server products such as SQL Server Standard/Enterprise Edition (SQL EE), SQL Server Express Edition (SQL XE).

SSEv is for small apps where you need basic data store and querying capabilities and not stored procs, sql batching ... etc. If you need these rich/advanced capabilities we would recommend you to use SQL XE.

SSEv is not a redundant product when compared to SQL XE. Each caters to different customer needs.

I hope I have not disappointed you by this post but thats the detail I can give for now :(

Thanks,

Laxmi Narsimha Rao ORUGANTI, SQL Server Everywhere, Microsoft Corporation

Can somebody explain this event in Sql Server Profiler?

Sql Server 2005; debugging a web application that accesses multiple databases.

I'm debugging some tsql in my web application using Profiler. Every once in awhile an Audit Login event will show up. This event contains the following text data:

-- network protocol: TCP/IP
set quoted_identifier on
set arithabort off
set numeric_roundabort off
set ansi_warnings on
set ansi_padding on
set ansi_nulls on
set concat_null_yields_null on
set cursor_close_on_commit off
set implicit_transactions off
set language us_english
set dateformat mdy
set datefirst 7
set transaction isolation level read committed

When this event shows up, there is a noticable lag in the time it takes for the query to return. I'm wondering if anybody can tell me

1) What causes this event

2) How often can I expect this to happen. I.e., it happens once per application instance, once per application instance touching a database for the first time, once every X minutes, once every x queries executed, etc.

TIA!

Every time a new connection is made by a client -and is very normal and necessary.