Showing posts with label web. Show all posts
Showing posts with label web. Show all posts

Thursday, March 29, 2012

best tutorial for sql reporting service 2005

i am asked to develop a web application where i have to display reports in a seperate window from a hyperlink .i have to display the report in grid format and show a pie chart within the report layout .

i need to give user credential like print,save the report in excel or doc format and email report.

can anybody give the links for the best tutorial to achieve my purpose.

thanks

sally

Hi there,

There are many resources available. Try books online.

Here is a great guide to building a report.

http://www.eggheadcafe.com/articles/20040823.asp

Here is a guide to building a report + a web interface.

http://www.15seconds.com/Issue/041013.htm

Try MS downloads for further samples.

cheers,

Andrew

|||

Reporting Services Tutorials >>> http://msdn2.microsoft.com/en-us/library/ms170246.aspx

Best Tool to Create Web Page?

I am looking to extend some customer data from my SQL Server out to the Web.
I am looking for the best utility to help create these pages\sites quickly.
We are running SQL Server 2000 and IIS 5.0
Thanks..Ted,
Refer sp_makewebtask in BooksOnLine.
--
Dinesh.
SQL Server FAQ at
http://www.tkdinesh.com
"Ted Appleberry" <ted@.appleberry.com> wrote in message
news:efO3YkNQDHA.2832@.TK2MSFTNGP10.phx.gbl...
> I am looking to extend some customer data from my SQL Server out to the
Web.
> I am looking for the best utility to help create these pages\sites
quickly.
> We are running SQL Server 2000 and IIS 5.0
> Thanks..
>|||You could use free community supported tool Web Matrix.
http://www.asp.net/webmatrix/default.aspx?tabindex=4&tabid=46
Thanks
sethu
"Ted Appleberry" <ted@.appleberry.com> wrote in message
news:OgY8aHOQDHA.1752@.TK2MSFTNGP12.phx.gbl...
> I am looking for a nice drag and drop interface or something. Third
Party..
> Don't mind spending $$$. Don't want to write a bunch of code if I can
avoid
> it.. Yes, I know.. I am a wimp..
> "Dinesh.T.K" <tkdinesh@.nospam.mail.tkdinesh.com> wrote in message
> news:eN3$erNQDHA.1988@.TK2MSFTNGP12.phx.gbl...
> > Ted,
> >
> > Refer sp_makewebtask in BooksOnLine.
> >
> > --
> > Dinesh.
> > SQL Server FAQ at
> > http://www.tkdinesh.com
> >
> > "Ted Appleberry" <ted@.appleberry.com> wrote in message
> > news:efO3YkNQDHA.2832@.TK2MSFTNGP10.phx.gbl...
> > > I am looking to extend some customer data from my SQL Server out to
the
> > Web.
> > > I am looking for the best utility to help create these pages\sites
> > quickly.
> > > We are running SQL Server 2000 and IIS 5.0
> > > Thanks..
> > >
> > >
> >
> >
>

Tuesday, March 27, 2012

Best scenario for SQL Server 7.0 replication in my situation?

Hi All,
What is the best scenario for seting-up database replication in my
situation?
I have two computers, each computer has...
-W2K, IIS5.0 Web server
-Cold Fusion 4.5 Web Application server
-SQL Server 7.0 database server
-Multihomed IP Addresses using Network Load Balancing
...If one computer goes down for any reason, Network Load Balancing
ensures that the other computer gets all the traffic (Network Load
Balancing is also supposed to split-up traffic between the two
computers, although I have not been able to create this behavior - all
the requests within a session seem to always go to computer #2, unless
it is switched-off, only then will the requests go to computer #1). The
"traffic" is Web requests to our Web site over HTTP and HTTPS.
I want to ensure that each database will "instantly" (or as close to
instantly as possible) take over if the other computer goes down. The
database synchronization needs to be concurrent with minimal latency.
For example, we are linked into Paypal's backend for accepting credit
card payments so we don't want a user to be able to "withdraw money
twice" because of a transaction record not being updated to the other
database.
What are some possible ways of acheiving this?
Thank You,
Nate
I would use a cluster to achieve this, as replication never works in both
directions with 'near to zero' latency.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
|||Thanks for the response. Do you mean clustering as in Windows
clustering in "Add/Remove Windows Components" or do you mean some other
clustering that I can setup through SQL Server 7.0?
Thanks Again,
Nate
|||Nate - this is exactly it. There are documents on the MS website and
sqlservercentral explaining how to set it up, but it's not for the
fainthearted, and depending on your background you might need a networking
guy to help get it set up.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)

Thursday, March 22, 2012

Best Practices Question: Create many common databases or many tables in one data

General Best Practices Question: Create many common data databases or many tables in one database? I am not a DBA!

In developing a web portal, ERP, or any large enterprise wide application made up of smaller task specific applications under the parent environment.

Should the design be to create a common data database and a specific database for each app or just put create one database and use best practices naming conventions? RI may or may not be a concern.

Areas of concern are: Maintenence, Security/Access, Performance, backup/restore, and file system and DB fragmentation benefits/hits.It depends on a whole host of questions. Will you need to do reporting across these applications? How will security need to be handled? What is the estimated size and growth of these seperate applicaitons?|||Originally posted by rhigdon
It depends on a whole host of questions. Will you need to do reporting across these applications? How will security need to be handled? What is the estimated size and growth of these seperate applicaitons?

I know my question is a broad one and it does bring up a whole host of questions. I can see many pros and cons for both approaches.

Reporting would be needed across all dbs or tables.
Security would be ADSI/NT Auth Mode.
Much of the apps data would grow very large (heavy I/O) and independently, while others would grow at a slower rate.|||What do you mean by "many common databases"? Do you mean duplicate schemas? I'd advise against that, unless you want rolling out upgrades, synchronizing lookup tables, and consolidating data for reporting to be a full-time job.

"Put all your eggs in one basket - and then WATCH THAT BASKET!"
-Mark Twain

blindman|||Originally posted by blindman
What do you mean by "many common databases"? Do you mean duplicate schemas? I'd advise against that, unless you want rolling out upgrades, synchronizing lookup tables, and consolidating data for reporting to be a full-time job.

"Put all your eggs in one basket - and then WATCH THAT BASKET!"
-Mark Twain

blindman

Databases that contain the data that is common to a specific application only and each then of those databases containing links to a database that contains data that is shared or common to all other apps/databases.|||If they are truly separate applications, then they should be separate databases.

Roll their data into a central data warehouse for analytical processing.

Maintain common data in central database and publish it to the clients to keep them synchronized. Each application should be stand-alone, and not rely on links to other databases if it can be helped.

This is going to be an ambitious project.

blindman

Best practices for SQL data access

Hi,

i am newbie in ASP.net world. i am using 3 tier application architechture for my web based application. data base is sql server 2000. i have looked at object and sql datasource objects but i think they are not suitable for my requirements. so i am planning to directly use ado.net to access data from database.( i.e. creating connection, then creating commands n executing them)

now what i am looking for is the best known practices for the above task. i have following solutions in my mind please let me know if i am missing some or which could be the best aproach.

careate one class which will handle all the database requests so that all the pages and business objects request that class to to do all the db related stuff. (creating connection, command n execution)

have a class which will return connection to your page or business object and then u can use that connection to do db related stuff.

some thing in between that you create a sqlcommand and pass it to a class which will take care of connections and execute you request.

what i am worried about more is the connections to database and the connection pooling n sharing stuff. i dont have any idea how they works.

please help me in this regard

thanks

Have you looked at the Data Access Application Block?

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

|||

thanks i had a look through it, n it sound goods.

any other thoughs or ideas???

|||

aakbar:

thanks i had a look through it, n it sound goods.

any other thoughs or ideas???

Yes, follow those suggestions there...Smile

|||

Outside of that, if was using ADO, I'd create a Business Logic class for each of the tables in my database using this class to generate all of the business logic which in turn would then call the ADO function within the DAL which would be your Data Application Blocks.

Tuesday, March 20, 2012

Best practices for an installation of SQL Server 2000 Reporting Se

Hi,
Where would one install SQL Service 2000 Reporting Services? I though about
installing them on a Web Server (with NO local SQL Server installed on) and
connection remote to a SQL Server 2000. Does this approach make sense?
I donâ't have a good feeling installing the Web Services on a Database Server
where I have to install IIS and the .NET Framework as well.
Best regards,
DanielThis will work fine. One point to keep in mind is that you have to have a
SQL Server license on the box with RS.
What I do is have SQL Server just for RS on the box. The data the reports
are based on reside on a different box. My feeling is why not have SQL
Server for the object caching that RS uses it for be on the same box. I have
to pay for it anyway.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Daniel Walzenbach" <daniel.walzenbach@.newsgroup.nospam> wrote in message
news:A0462F4B-9A38-4B88-B2DB-C42B6514EF8B@.microsoft.com...
> Hi,
> Where would one install SQL Service 2000 Reporting Services? I though
> about
> installing them on a Web Server (with NO local SQL Server installed on)
> and
> connection remote to a SQL Server 2000. Does this approach make sense?
> I don't have a good feeling installing the Web Services on a Database
> Server
> where I have to install IIS and the .NET Framework as well.
> Best regards,
> Daniel|||Bruce,
Thanks for your answer! Just to make sure I got your point. You suggest to
have both (SQL Server and RS) installed on the same computer? Am I also right
that this constellation would only require on SQL Server license?
And one more question: Can RS be installed on a computer with NO SQL Server
installed? I had some troulbe installing RS on my Web Server where on SQL
Server is installed on. The installation skipped the part where I am supposed
to select the SQL Server but told me all is fine :-( This problem though
could have been caused by the Terminal Services which I had not disabled
(Will try tomorrow).
Thanks!
Daniel
"Bruce L-C [MVP]" wrote:
> This will work fine. One point to keep in mind is that you have to have a
> SQL Server license on the box with RS.
> What I do is have SQL Server just for RS on the box. The data the reports
> are based on reside on a different box. My feeling is why not have SQL
> Server for the object caching that RS uses it for be on the same box. I have
> to pay for it anyway.
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "Daniel Walzenbach" <daniel.walzenbach@.newsgroup.nospam> wrote in message
> news:A0462F4B-9A38-4B88-B2DB-C42B6514EF8B@.microsoft.com...
> > Hi,
> >
> > Where would one install SQL Service 2000 Reporting Services? I though
> > about
> > installing them on a Web Server (with NO local SQL Server installed on)
> > and
> > connection remote to a SQL Server 2000. Does this approach make sense?
> >
> > I don't have a good feeling installing the Web Services on a Database
> > Server
> > where I have to install IIS and the .NET Framework as well.
> >
> > Best regards,
> >
> > Daniel
>
>|||From a licensing perspective there is no difference. You have to have a SQL
Server license for the box that has Reporting Services. Reporting Services
uses SQL Server for it's object storage. For instance, all reports are
stored in the database. You will not see any rdl files on the server. It
uses SQL Server for other objects as well. So, RS has to have SQL Server
somewhere. If you use a SQL Server that is somewhere other than the box you
are installing RS on you have to use the command line install and specify
where SQL Server can be found. I have not done this myself. I assume the
info on how to do this is in the readme. If you use the setup program it
plans that SQL Server is on the box you are installing RS.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Daniel Walzenbach" <daniel.walzenbach@.newsgroup.nospam> wrote in message
news:E02F3FE4-EDD4-4A35-AD4D-D772A811424A@.microsoft.com...
> Bruce,
> Thanks for your answer! Just to make sure I got your point. You suggest to
> have both (SQL Server and RS) installed on the same computer? Am I also
> right
> that this constellation would only require on SQL Server license?
> And one more question: Can RS be installed on a computer with NO SQL
> Server
> installed? I had some troulbe installing RS on my Web Server where on SQL
> Server is installed on. The installation skipped the part where I am
> supposed
> to select the SQL Server but told me all is fine :-( This problem though
> could have been caused by the Terminal Services which I had not disabled
> (Will try tomorrow).
> Thanks!
> Daniel
>
> "Bruce L-C [MVP]" wrote:
>> This will work fine. One point to keep in mind is that you have to have a
>> SQL Server license on the box with RS.
>> What I do is have SQL Server just for RS on the box. The data the reports
>> are based on reside on a different box. My feeling is why not have SQL
>> Server for the object caching that RS uses it for be on the same box. I
>> have
>> to pay for it anyway.
>>
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>> "Daniel Walzenbach" <daniel.walzenbach@.newsgroup.nospam> wrote in message
>> news:A0462F4B-9A38-4B88-B2DB-C42B6514EF8B@.microsoft.com...
>> > Hi,
>> >
>> > Where would one install SQL Service 2000 Reporting Services? I though
>> > about
>> > installing them on a Web Server (with NO local SQL Server installed on)
>> > and
>> > connection remote to a SQL Server 2000. Does this approach make sense?
>> >
>> > I don't have a good feeling installing the Web Services on a Database
>> > Server
>> > where I have to install IIS and the .NET Framework as well.
>> >
>> > Best regards,
>> >
>> > Daniel
>>|||Thank you Bruce,
this is good to know!
Daniel
"Bruce L-C [MVP]" <bruce_lcNOSPAM@.hotmail.com> schrieb im Newsbeitrag
news:%238AtkHJYFHA.2796@.TK2MSFTNGP09.phx.gbl...
> From a licensing perspective there is no difference. You have to have a
> SQL Server license for the box that has Reporting Services. Reporting
> Services uses SQL Server for it's object storage. For instance, all
> reports are stored in the database. You will not see any rdl files on the
> server. It uses SQL Server for other objects as well. So, RS has to have
> SQL Server somewhere. If you use a SQL Server that is somewhere other than
> the box you are installing RS on you have to use the command line install
> and specify where SQL Server can be found. I have not done this myself. I
> assume the info on how to do this is in the readme. If you use the setup
> program it plans that SQL Server is on the box you are installing RS.
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "Daniel Walzenbach" <daniel.walzenbach@.newsgroup.nospam> wrote in message
> news:E02F3FE4-EDD4-4A35-AD4D-D772A811424A@.microsoft.com...
>> Bruce,
>> Thanks for your answer! Just to make sure I got your point. You suggest
>> to
>> have both (SQL Server and RS) installed on the same computer? Am I also
>> right
>> that this constellation would only require on SQL Server license?
>> And one more question: Can RS be installed on a computer with NO SQL
>> Server
>> installed? I had some troulbe installing RS on my Web Server where on SQL
>> Server is installed on. The installation skipped the part where I am
>> supposed
>> to select the SQL Server but told me all is fine :-( This problem though
>> could have been caused by the Terminal Services which I had not disabled
>> (Will try tomorrow).
>> Thanks!
>> Daniel
>>
>> "Bruce L-C [MVP]" wrote:
>> This will work fine. One point to keep in mind is that you have to have
>> a
>> SQL Server license on the box with RS.
>> What I do is have SQL Server just for RS on the box. The data the
>> reports
>> are based on reside on a different box. My feeling is why not have SQL
>> Server for the object caching that RS uses it for be on the same box. I
>> have
>> to pay for it anyway.
>>
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>> "Daniel Walzenbach" <daniel.walzenbach@.newsgroup.nospam> wrote in
>> message
>> news:A0462F4B-9A38-4B88-B2DB-C42B6514EF8B@.microsoft.com...
>> > Hi,
>> >
>> > Where would one install SQL Service 2000 Reporting Services? I though
>> > about
>> > installing them on a Web Server (with NO local SQL Server installed
>> > on)
>> > and
>> > connection remote to a SQL Server 2000. Does this approach make sense?
>> >
>> > I don't have a good feeling installing the Web Services on a Database
>> > Server
>> > where I have to install IIS and the .NET Framework as well.
>> >
>> > Best regards,
>> >
>> > Daniel
>>
>|||" If you use a SQL Server that is somewhere other than the box you
are installing RS on you have to use the command line install and specify
where SQL Server can be found."-Bruce
Are you absolutely 100% certain this is the case?
I'm certainly stuck trying to install enterprise RS on the web server
pointing to a SQL server DB on another sql server(2000). Problem is the
install ends "successfully" but then throws an activivation error. No
resolution for this error in sight.
However if I MUST use the commend line too to configure RS across servers
this may explain the activiation error. I don't remember finding anything
documented telling me I must use this command line approach.
Please verify this is true. Thanks! Could save a lot of headaches...

Best Practices Database Owner, Database Connection Method (asp)

Hi-

I have a sql server database, and am wring web apps to access it.

I've created databases different ways, and ended up with different owners (eg dbo, nt authority\network services...)

I also have connection strings using windows authentication, and some using a user name and password.

I have read that using windows authentication is the best way to go, as far as security goes, but I have noticed some connectivity issues when I upload the site to the server, and test it remotely.

What is the safest 'owner' of the database, and what's the safest way to connect?

Thanks

Dan

You may get somewhat different details from different people but I think most will agree with what I'm about to say (I may live to regret those words!). Remember that the goal is give your users a little privileges as possible

owner of the database should be dbo

|||

Create a login which has an entry in your Active Directory (AD)*, and give it the needed permissions.

Map that login to a database user (name it MyAppUser), this user has only needed permisions on the database (e.g. execute stored procedures and maybe SELECTing some fields from some tables).

Use Windows Authentication if it is possible.

Encrypt your ConnectionString in your Web.Config file.

*: you can enforce some policies like password has to be strong and changed every two weeks or months. Old password can not be used and some policies that can increase the security.

Remember: Too much security doesn't always good.

Good luck.

|||

One more thing I would like to mention is try to use stored procedures ONLY as much as you can.

This will increase the performance (usually) and make your App secure (e.g. SQL Injuction).

Try to not thatMyAppUserother thatEXECstored procedures.

Insred of sending a lot of T-SQL statments over the network, you will just send the stored procedure name.. and once it is executed it will be cached (better performance for later execution).

Make you logic in the stored procedure, allow you to change the logic later -if needed- without redeploying the application or compiling it.

Good luck.

|||

OK, so stored procedures seems to be a common theme.

hodw do I best use them(SP), and use the GUI advantage of visual studio.net?

Do I write, say a SP called "SP_Update_Client()" Then have the asp.net page call

"SP_Update_Client("Param1","Param2")

and how do I get a hold of the stored procedure IN Visual studio?

thanks

dan

(Im getting lazzy in this GUI world)

|||

You don't "get hold" of a proc like you would, say, a dll. You create a sql command and attach parameters to it as in this example http://www.codeproject.com/useritems/simplecodeasp.asp

Note esp their use of output parameters to return data

|||

hummm-

I think Im starting to get it.

If I am writing a small app (500 users, connecting 10 - 25 x a week) will I notice a benifit of procs? in speed? Or is it more of a security issue at this size?

Thanks so much for the discussion an the artilce

|||

Harperator:

If I am writing a small app (500 users, connecting 10 - 25 x a week) will I notice a benifit of procs? in speed? Or is it more of a security issue at this size?

Stored Procedure = Both security + performance, but the main thing here is the security especially SQL Injuction.

Good luck.

|||


Agree with CS4Ever's statement

Best Practices - SQL Transactions

I have a web app (ASP) that does all updates, inserts by calling
transaction-supported COM+ components (with the transaction started in the
ASP page, i.e. transaction=required) that use ADO to call stored procedures
(that usually involve single tables). If there is any error (missing SP,
parameter value of wrong type, etc.) with the database insert/update, MTS
automatically rolls back everything that was done in the database (and maybe
SQL Server does that with any error in an SP anyway'). As such, when I
write the SPs, I have not been including BEGIN TRAN, COMMIT TRAN, or
checking for a transaction error (@.@.error) and then doing a ROLLBACK TRAN.
So, I have many SPs (that do not return any indication of success, or not)
like
INSERT INTO Table
(ColumnA, ColumnB)
VALUES
(ValueA, ValueB)
WHERE
Some condition
As a matter of best practice, should SQL programmers always enclose INSERTs,
UPDATEs within transactional statements in a production database? Should one
always check for errors with INSERTS or UPDATES? Or, with errors like I
describe (but not with business logic), does SQL Server automatically
rollback everything in an SP? Or, should one just save those statements for
when the SQL script and logic itself takes care of rolling back a database
when a series of updates or inserts are made?
Thanks for any thoughts."Don Miller" <nospam@.nospam.com> wrote in message
news:eKR64AMbGHA.4144@.TK2MSFTNGP04.phx.gbl...
>I have a web app (ASP) that does all updates, inserts by calling
> transaction-supported COM+ components (with the transaction started in the
> ASP page, i.e. transaction=required) that use ADO to call stored
> procedures
> (that usually involve single tables). If there is any error (missing SP,
> parameter value of wrong type, etc.) with the database insert/update, MTS
> automatically rolls back everything that was done in the database (and
> maybe
> SQL Server does that with any error in an SP anyway'). As such, when I
> write the SPs, I have not been including BEGIN TRAN, COMMIT TRAN, or
> checking for a transaction error (@.@.error) and then doing a ROLLBACK TRAN.
> So, I have many SPs (that do not return any indication of success, or not)
> like
> INSERT INTO Table
> (ColumnA, ColumnB)
> VALUES
> (ValueA, ValueB)
> WHERE
> Some condition
> As a matter of best practice, should SQL programmers always enclose
> INSERTs,
> UPDATEs within transactional statements in a production database? Should
> one
> always check for errors with INSERTS or UPDATES?
No,

>Or, with errors like I
> describe (but not with business logic), does SQL Server automatically
> rollback everything in an SP?
No, but the client will get an error message and rollback.
Usually, stored procedures should not contain transactional logic. Let the
client take care of it.
David|||Don Miller wrote:
> As a matter of best practice, should SQL programmers always enclose INSERT
s,
> UPDATEs within transactional statements in a production database? Should o
ne
> always check for errors with INSERTS or UPDATES? Or, with errors like I
> describe (but not with business logic), does SQL Server automatically
> rollback everything in an SP? Or, should one just save those statements fo
r
> when the SQL script and logic itself takes care of rolling back a database
> when a series of updates or inserts are made?
My thoughts are:
1) Transactions are only required if there's more than one DML
statement (or SELECT statement that needs to maintain a lock).
2) Error checking should be done after any statement that can fail.
This includes all DML and DDL statements. Pretty much everything except
SELECTs (though I guess they could technically fail as well...).
Kris|||David wrote:
> Usually, stored procedures should not contain transactional logic. > Let the clie
nt take care of it.
Are you sure? Isn't it better to ensure your stored procedures are
transactionally correct regardless of where they are executed from?
Kris|||To my knowledge, an error is not sufficient for MTS to roll back: if you do
not call ObjectContext.SetAbort explicitely, MTS will think that the whole
operation has been successfull and will commit it; even if there have been
one or multiple errors.
In the same way, if there is an error inside a SP, SQL-Server will not
rollback the transaction automatically for you: you must check for any error
(@.@.error) and call the rollback operation yourself.
Even if the SP is already enrolled in a transaction, you still need to check
for a transaction error (@.@.error) if there is such a possibility inside the
SP and this, even if you have not included a BEGIN TRAN inside it.
To be clear, transactions and errors are not same: the fact that there have
been an error doesn't mean that the transaction will be or need to be
aborted.
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF
"Don Miller" <nospam@.nospam.com> wrote in message
news:eKR64AMbGHA.4144@.TK2MSFTNGP04.phx.gbl...
>I have a web app (ASP) that does all updates, inserts by calling
> transaction-supported COM+ components (with the transaction started in the
> ASP page, i.e. transaction=required) that use ADO to call stored
> procedures
> (that usually involve single tables). If there is any error (missing SP,
> parameter value of wrong type, etc.) with the database insert/update, MTS
> automatically rolls back everything that was done in the database (and
> maybe
> SQL Server does that with any error in an SP anyway'). As such, when I
> write the SPs, I have not been including BEGIN TRAN, COMMIT TRAN, or
> checking for a transaction error (@.@.error) and then doing a ROLLBACK TRAN.
> So, I have many SPs (that do not return any indication of success, or not)
> like
> INSERT INTO Table
> (ColumnA, ColumnB)
> VALUES
> (ValueA, ValueB)
> WHERE
> Some condition
> As a matter of best practice, should SQL programmers always enclose
> INSERTs,
> UPDATEs within transactional statements in a production database? Should
> one
> always check for errors with INSERTS or UPDATES? Or, with errors like I
> describe (but not with business logic), does SQL Server automatically
> rollback everything in an SP? Or, should one just save those statements
> for
> when the SQL script and logic itself takes care of rolling back a database
> when a series of updates or inserts are made?
> Thanks for any thoughts.
>|||Don Miller (nospam@.nospam.com) writes:
> INSERT INTO Table
> (ColumnA, ColumnB)
> VALUES
> (ValueA, ValueB)
> WHERE
> Some condition
> As a matter of best practice, should SQL programmers always enclose
> INSERTs, UPDATEs within transactional statements in a production
> database? Should one always check for errors with INSERTS or UPDATES?
> Or, with errors like I describe (but not with business logic), does SQL
> Server automatically rollback everything in an SP? Or, should one just
> save those statements for when the SQL script and logic itself takes
> care of rolling back a database when a series of updates or inserts are
> made?
If it's a single statement, there is no reason to have BEGIN/COMMIT
TRANSACTION around it, since the statement is a transaction in itself.
However, if you procedure performs several INSERT/UPDATE/DELETE statements
there should be a transaction around it. The procedure should not rely on
that the caller has set up a transaction. Sometimes you have a procedure
that you know is only performing part of a game. In this case, it is a
good habit to have this in the beginning:
IF @.@.trancount = 0
BEGIN
RAISERROR ('This procedure must be called with an active transaction',
16, 1)
RETURN 1
END
In SQL 2005, error checking in stored procedures can be handled with
TRY-CATCH. In SQL 2000, you need to check @.@.error, and if you have
started a transaction, you should rollback, since you know that you
were not able to fulfil your contract.
I have two articles on error handling in SQL Server on my web site.
http://www.sommarskog.se/error-handling-II.html gives more suggestions
on implementing error handling.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||> In the same way, if there is an error inside a SP, SQL-Server will not
> rollback the transaction automatically for you: you must check for any
> error (@.@.error) and call the rollback operation yourself.
The exception is when SET XACT_ABORT ON is active on the connection or proc.
SQL Server will then rollback the transaction and abort the batch when
runtime errors are encountered. However, compile errors are not affected
with XACT_ABORT ON so @.@.ERROR still needs to be checked when you want to
safeguard against all errors.
Hope this helps.
Dan Guzman
SQL Server MVP
"Sylvain Lafontaine" <sylvain aei ca (fill the blanks, no spam please)>
wrote in message news:uUuZ5PNbGHA.1536@.TK2MSFTNGP02.phx.gbl...
> To my knowledge, an error is not sufficient for MTS to roll back: if you
> do not call ObjectContext.SetAbort explicitely, MTS will think that the
> whole operation has been successfull and will commit it; even if there
> have been one or multiple errors.
> In the same way, if there is an error inside a SP, SQL-Server will not
> rollback the transaction automatically for you: you must check for any
> error (@.@.error) and call the rollback operation yourself.
> Even if the SP is already enrolled in a transaction, you still need to
> check for a transaction error (@.@.error) if there is such a possibility
> inside the SP and this, even if you have not included a BEGIN TRAN inside
> it.
>
> To be clear, transactions and errors are not same: the fact that there
> have been an error doesn't mean that the transaction will be or need to be
> aborted.
> --
> Sylvain Lafontaine, ing.
> MVP - Technologies Virtual-PC
> E-mail: http://cerbermail.com/?QugbLEWINF
>
> "Don Miller" <nospam@.nospam.com> wrote in message
> news:eKR64AMbGHA.4144@.TK2MSFTNGP04.phx.gbl...
>|||<kriskirk@.hotmail.com> wrote in message
news:1146449658.432935.118620@.j73g2000cwa.googlegroups.com...
> David wrote:
> Are you sure? Isn't it better to ensure your stored procedures are
> transactionally correct regardless of where they are executed from?
>
Ideally yes. Stored procedures should be atomic, consistent, and isolated.
They should typically not be durable because that makes assumptions about
where the procedure fits inside user transactions. But it requires quite a
bit of transaction handling code to make that happen.
Here's an example. A stored procedure should almost never issue a ROLLBACK
except to a savepoint. If it does then it can't be called in the scope of
an existing transaction. That might be OK for administrative stuff that you
know will be run from Management Studio, but for regular database
transactions.
create procedure foo
as
begin
begin transaction foo
begin try
'do work here
commit transaction
end try
begin catch
rollback transaction foo
commit transaction
exec usp_reraise_error
end catch
David|||"David Browne" <davidbaxterbrowne no potted meat@.hotmail.com> wrote in
message news:e4G3seSbGHA.4116@.TK2MSFTNGP05.phx.gbl...
> <kriskirk@.hotmail.com> wrote in message
> news:1146449658.432935.118620@.j73g2000cwa.googlegroups.com...
>
> Ideally yes. Stored procedures should be atomic, consistent, and
> isolated. They should typically not be durable because that makes
> assumptions about where the procedure fits inside user transactions. But
> it requires quite a bit of transaction handling code to make that happen.
> Here's an example. A stored procedure should almost never issue a
> ROLLBACK except to a savepoint. If it does then it can't be called in the
> scope of an existing transaction. That might be OK for administrative
> stuff that you know will be run from Management Studio, but for regular
> database transactions.
>
Oops, here's a correction after morinng coffee.
create procedure foo
as
begin transaction
save transaction proc_scope
begin try
--DO WORK HERE
commit transaction
end try
begin catch
rollback transaction proc_scope
commit transaction
declare @.errormessage nvarchar(4000),
@.errorseverity int
select
@.errormessage = error_message(),
@.errorseverity = error_severity()
raiserror(@.errormessage, @.errorseverity, 1)
end catch
In SQL 2005 you can just cut and paste all this junk around your procedure,
and you don't have to pollute the implementation with a bunch of error
handling noise.
So there is a right way to do transaction handling in a stored proceudre,
and it isn't all that hard, but transacaction handling is basically the
responsibility of the client code.
David|||Thanks to all who have responded, although I'm still not quite sure whether
I should (or need to) revisit about 100 SPs I have (that are called from a
client transaction through COM+ - and yes, the client does the
ObjectContext.SetAbort duties). It does work today with rollbacks as
necessary and expected but I felt lazy by relying on ASP to start the
transaction and have the MTS blackbox take care of the details especially
when dealing with SQL Server. But I guess that's a feature ;)
And thanks to Erland Sommarskog for the very thoughtful piece about error
handling.
"Don Miller" <nospam@.nospam.com> wrote in message
news:eKR64AMbGHA.4144@.TK2MSFTNGP04.phx.gbl...
> I have a web app (ASP) that does all updates, inserts by calling
> transaction-supported COM+ components (with the transaction started in the
> ASP page, i.e. transaction=required) that use ADO to call stored
procedures
> (that usually involve single tables). If there is any error (missing SP,
> parameter value of wrong type, etc.) with the database insert/update, MTS
> automatically rolls back everything that was done in the database (and
maybe
> SQL Server does that with any error in an SP anyway'). As such, when I
> write the SPs, I have not been including BEGIN TRAN, COMMIT TRAN, or
> checking for a transaction error (@.@.error) and then doing a ROLLBACK TRAN.
> So, I have many SPs (that do not return any indication of success, or not)
> like
> INSERT INTO Table
> (ColumnA, ColumnB)
> VALUES
> (ValueA, ValueB)
> WHERE
> Some condition
> As a matter of best practice, should SQL programmers always enclose
INSERTs,
> UPDATEs within transactional statements in a production database? Should
one
> always check for errors with INSERTS or UPDATES? Or, with errors like I
> describe (but not with business logic), does SQL Server automatically
> rollback everything in an SP? Or, should one just save those statements
for
> when the SQL script and logic itself takes care of rolling back a database
> when a series of updates or inserts are made?
> Thanks for any thoughts.
>

Monday, March 19, 2012

Best Practice Question

I have a web server that needs access to SQL. The web server is currently in
a DMZ and SQL is in on the internal network. We are currently using standard
security to access SQL, but I have heard that standard security is not as
secure as windows security. Can windows security work across a firewall?
What is the recommended practice in this very common scenario? I'm not
really familiar with ISA server but am also wondering if it could be used to
gain any advantage in this scenario (perhaps with server publishing, etc). I
want to achieve the maximum security with the least administrative overhead.
Any pointers would be appreciated. Thanks.Elmer
Visit at
http://vyaskn.tripod.com/sql_server...t_practices.htm --secu
rity
best practices
"Elmer Miller" <millere@.empireco.nospam> wrote in message
news:%23S6LtXNxEHA.3024@.TK2MSFTNGP14.phx.gbl...
> I have a web server that needs access to SQL. The web server is currently
in
> a DMZ and SQL is in on the internal network. We are currently using
standard
> security to access SQL, but I have heard that standard security is not as
> secure as windows security. Can windows security work across a firewall?
> What is the recommended practice in this very common scenario? I'm not
> really familiar with ISA server but am also wondering if it could be used
to
> gain any advantage in this scenario (perhaps with server publishing, etc).
I
> want to achieve the maximum security with the least administrative
overhead.
> Any pointers would be appreciated. Thanks.
>

Best Practice for Windows Authentication?

Hi,
We are changing our classic ASP web application to use Windows
Authentication instead of SQL Server Authentication.
I would like to know the best practice for:
1. IIS and SQL Server are on the same machine and
2.When they are on different machines in the same domain.
I *think* the solution to 1. is to add the IUSR_MACHINENAME user to SQL
Server (this works but is it the best practice?)
For 2. I have read different opinions. Some say create a IUSR_IISMACHINENAME
account on the SQL Server and make sure they have the same password. Other
say create a user on the domain and use that in IIS as the anonymous user
(and give that user the relevant rights on SQL Server)
I would like to know what is considered the best practice for this sort of
authentication.
Thanks in advancewhat version of IIS you running ?, using ASP.NET ?
http://msdn2.microsoft.com/en-us/library/bsz5788z
"Hugh Mungo" <hugh_mungo@.hotmail.com> wrote in message
news:%23igmiopuFHA.3500@.TK2MSFTNGP09.phx.gbl...
> Hi,
> We are changing our classic ASP web application to use Windows
> Authentication instead of SQL Server Authentication.
> I would like to know the best practice for:
> 1. IIS and SQL Server are on the same machine and
> 2.When they are on different machines in the same domain.
> I *think* the solution to 1. is to add the IUSR_MACHINENAME user to SQL
> Server (this works but is it the best practice?)
> For 2. I have read different opinions. Some say create a
> IUSR_IISMACHINENAME
> account on the SQL Server and make sure they have the same password. Other
> say create a user on the domain and use that in IIS as the anonymous user
> (and give that user the relevant rights on SQL Server)
> I would like to know what is considered the best practice for this sort of
> authentication.
> Thanks in advance
>|||The solution should work with IIS5 and above.
We are not using ASP.NET this is a classic ASP application.
"David J. Cartwright" <davidcartwright@.hotmail.com> wrote in message
news:OcQFYgruFHA.2076@.TK2MSFTNGP14.phx.gbl...
> what version of IIS you running ?, using ASP.NET ?
> http://msdn2.microsoft.com/en-us/library/bsz5788z
> "Hugh Mungo" <hugh_mungo@.hotmail.com> wrote in message
> news:%23igmiopuFHA.3500@.TK2MSFTNGP09.phx.gbl...
Other[vbcol=seagreen]
user[vbcol=seagreen]
of[vbcol=seagreen]
>|||What a coincidence. Same here. I would definitely be interested to know
how to do this best practice also as this is the exact same thing that I'm
currently working on. One slightly different thing here is that we require
individual accounts (so we can track user activity with our sql profiler)
and would believe we would create a windows account on our domain controller
which resides on a different machine than our web (.asp files) and sql
server (also on separate machine) and was wondering if this would be
possible and how to go about doing this. Would it be as straight forward in
changing the connection string in our .asp files specifying windows
authentication? I am not too familiar in how to do this but was thinking of
maybe removing the anonymous account in IIS so that it would force the user
to login with the windows authentication pop up (in the possible situation
if users share a public machine and/or if the machine's operating system is
not windows with a valid corresponding domain windows account on our domain
controller?...which makes me wonder how this would be incorporated into our
connection string in our .asp files? Thanks in advance
"Hugh Mungo" <hugh_mungo@.hotmail.com> wrote in message
news:eJLVIyruFHA.2312@.TK2MSFTNGP14.phx.gbl...
> The solution should work with IIS5 and above.
> We are not using ASP.NET this is a classic ASP application.
> "David J. Cartwright" <davidcartwright@.hotmail.com> wrote in message
> news:OcQFYgruFHA.2076@.TK2MSFTNGP14.phx.gbl...
> Other
> user
> of
>|||_-=?/today_-=?/354
"Hugh Mungo" wrote:

> Hi,
> We are changing our classic ASP web application to use Windows
> Authentication instead of SQL Server Authentication.
> I would like to know the best practice for:
> 1. IIS and SQL Server are on the same machine and
> 2.When they are on different machines in the same domain.
> I *think* the solution to 1. is to add the IUSR_MACHINENAME user to SQL
> Server (this works but is it the best practice?)
> For 2. I have read different opinions. Some say create a IUSR_IISMACHINENA
ME
> account on the SQL Server and make sure they have the same password. Other
> say create a user on the domain and use that in IIS as the anonymous user
> (and give that user the relevant rights on SQL Server)
> I would like to know what is considered the best practice for this sort of
> authentication.
> Thanks in advance
>
>

Sunday, March 11, 2012

Best practice for managing multiple servers

Hi, Does anyone know of a whitepaper or web site containing best practice
information for the Administration of multiple SQL servers?.
I am looking at Administrating multiple servers and would like to create a
one point for administration and notification of the failure of jobs.
Many thanks.
Nick
Search on http://www.sql-server-performance.co...ced_search.asp
"Nick" <Nick@.discussions.microsoft.com> wrote in message
news:D54FBB07-4BE9-4620-BCC0-5DC79015AB7C@.microsoft.com...
> Hi, Does anyone know of a whitepaper or web site containing best practice
> information for the Administration of multiple SQL servers?.
> I am looking at Administrating multiple servers and would like to create a
> one point for administration and notification of the failure of jobs.
> Many thanks.
|||There may be some useful information here:
Operations Guide -SQL Server 2000
http://www.microsoft.com/technet/pro...n/sqlops0.mspx
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"Nick" <Nick@.discussions.microsoft.com> wrote in message
news:D54FBB07-4BE9-4620-BCC0-5DC79015AB7C@.microsoft.com...
> Hi, Does anyone know of a whitepaper or web site containing best practice
> information for the Administration of multiple SQL servers?.
> I am looking at Administrating multiple servers and would like to create a
> one point for administration and notification of the failure of jobs.
> Many thanks.

Best practice for managing multiple servers

Hi, Does anyone know of a whitepaper or web site containing best practice
information for the Administration of multiple SQL servers?.
I am looking at Administrating multiple servers and would like to create a
one point for administration and notification of the failure of jobs.
Many thanks.Nick
Search on http://www.sql-server-performance.c...nced_search.asp
"Nick" <Nick@.discussions.microsoft.com> wrote in message
news:D54FBB07-4BE9-4620-BCC0-5DC79015AB7C@.microsoft.com...
> Hi, Does anyone know of a whitepaper or web site containing best practice
> information for the Administration of multiple SQL servers?.
> I am looking at Administrating multiple servers and would like to create a
> one point for administration and notification of the failure of jobs.
> Many thanks.|||There may be some useful information here:
Operations Guide -SQL Server 2000
http://www.microsoft.com/technet/pr...in/sqlops0.mspx
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"Nick" <Nick@.discussions.microsoft.com> wrote in message
news:D54FBB07-4BE9-4620-BCC0-5DC79015AB7C@.microsoft.com...
> Hi, Does anyone know of a whitepaper or web site containing best practice
> information for the Administration of multiple SQL servers?.
> I am looking at Administrating multiple servers and would like to create a
> one point for administration and notification of the failure of jobs.
> Many thanks.

Best practice for managing multiple servers

Hi, Does anyone know of a whitepaper or web site containing best practice
information for the Administration of multiple SQL servers?.
I am looking at Administrating multiple servers and would like to create a
one point for administration and notification of the failure of jobs.
Many thanks.Nick
Search on http://www.sql-server-performance.com/advanced_search.asp
"Nick" <Nick@.discussions.microsoft.com> wrote in message
news:D54FBB07-4BE9-4620-BCC0-5DC79015AB7C@.microsoft.com...
> Hi, Does anyone know of a whitepaper or web site containing best practice
> information for the Administration of multiple SQL servers?.
> I am looking at Administrating multiple servers and would like to create a
> one point for administration and notification of the failure of jobs.
> Many thanks.|||There may be some useful information here:
Operations Guide -SQL Server 2000
http://www.microsoft.com/technet/prodtechnol/sql/2000/maintain/sqlops0.mspx
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"Nick" <Nick@.discussions.microsoft.com> wrote in message
news:D54FBB07-4BE9-4620-BCC0-5DC79015AB7C@.microsoft.com...
> Hi, Does anyone know of a whitepaper or web site containing best practice
> information for the Administration of multiple SQL servers?.
> I am looking at Administrating multiple servers and would like to create a
> one point for administration and notification of the failure of jobs.
> Many thanks.

Thursday, March 8, 2012

Best Practice

We have a dedicated web server that runs SQL it is not hosted on our network
it is hosted by an ISP. We also run an inhouse SQL server. We need to get
info back and forth between the two DB's. What would be the best way to do
this securely.
Thank youA Scheduled DTS task. But, your table design needs to be able to handle such
a model.
You need a way to identify changed rows and a way to resolve them is they
were both changed between synchronization.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Ryan" <Ryan@.discussions.microsoft.com> wrote in message
news:4D58A22F-4269-4365-861C-DA7E202EFA04@.microsoft.com...
> We have a dedicated web server that runs SQL it is not hosted on our
> network
> it is hosted by an ISP. We also run an inhouse SQL server. We need to get
> info back and forth between the two DB's. What would be the best way to do
> this securely.
> Thank you|||Thank you for your reply one other question. Would the DTS package be secure
?
"Mike Epprecht (SQL MVP)" wrote:

> A Scheduled DTS task. But, your table design needs to be able to handle su
ch
> a model.
> You need a way to identify changed rows and a way to resolve them is they
> were both changed between synchronization.
> Regards
> --
> Mike Epprecht, Microsoft SQL Server MVP
> Zurich, Switzerland
> IM: mike@.epprecht.net
> MVP Program: http://www.microsoft.com/mvp
> Blog: http://www.msmvps.com/epprecht/
> "Ryan" <Ryan@.discussions.microsoft.com> wrote in message
> news:4D58A22F-4269-4365-861C-DA7E202EFA04@.microsoft.com...
>
>

Wednesday, March 7, 2012

Best method to access web service

We have a billing web service where you passs in the account and amount and get returned an XML string with result.

I had suggested that I open up an endpoint and have the service listen for messages but the programming team wont go for it.

What is the best method for me to call an external web service? I have tried sp_OACreate and run into memory leaks and have not had much luck with assemblies. See http://www.codeproject.com/script/comments/forums.asp?forumid=1725&select=2180035&df=100&msg=2180035

The best method should be assemblies, follow the old post from Vineet: http://blogs.msdn.com/sqlclr/archive/2005/07/25/Vineet.aspx, it shows how to explictly generate the serialization code If I remeber correctly the problem is that the default option for Visual studio projects is to generate code that creates the serialization at runtime, invoking csc.exe on the fly, which clearly won't work for SQL assemblies.

Openning an endpoint (I asumme an HTTP endpoint) won't solve your problem, that is available only for incomming calls (an app can access your SQL endpoint as an WS call) and my understanding is that you want to do it the other way (have a SQL procedure invoke a WS)

Best Method for Web Access to SQL

Hi,
I manage a public website for a bank. We just upgraded the website from a M
icrosoft Access database backend to a SQL Server database backend. I initia
lly installed SQL with Windows Authentication only. But then I ran into pro
blems when the website was
configured with Anonymous access because SQL Server was requiring a Windows
User ID and Password. I changed the security to use SQL Server authenticati
on, I created an account in SQL Server, and put the User ID and Password in
my connection string. Now
it works but I am concerned with the security. I don't know if the other SQ
L Server IDs are vulnerable to hacking, e.g. sa.
I was thinking it might be possible to use Windows Authentication only on th
e database and grant access to the IUSR_* account. But I didn't test this t
o see if it would work.
Which is the most secure method of securing SQL Server when the website is c
onfigured with Anonymous access? The current configuration described in the
first paragraph or something similar to what I described in the second para
graph? The website must be
configured with Anonymous access. That is one requirement I can not change.
KB articles would help me.
Thanks.
DaveAdd the IUSR_* account as a login on your SQL Server. Grant it access only
to the relevant databases and objects therein. If your SQL Server and IIS
server are on separate machines - as they should be - you'll need a domain
account for IUSR_*.
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
.
"David" <david_eastes@.yahoo.com> wrote in message
news:CB7D44CE-A18F-41AA-BA9B-E60560743DE2@.microsoft.com...
Hi,
I manage a public website for a bank. We just upgraded the website from a
Microsoft Access database backend to a SQL Server database backend. I
initially installed SQL with Windows Authentication only. But then I ran
into problems when the website was configured with Anonymous access because
SQL Server was requiring a Windows User ID and Password. I changed the
security to use SQL Server authentication, I created an account in SQL
Server, and put the User ID and Password in my connection string. Now it
works but I am concerned with the security. I don't know if the other SQL
Server IDs are vulnerable to hacking, e.g. sa.
I was thinking it might be possible to use Windows Authentication only on
the database and grant access to the IUSR_* account. But I didn't test this
to see if it would work.
Which is the most secure method of securing SQL Server when the website is
configured with Anonymous access? The current configuration described in
the first paragraph or something similar to what I described in the second
paragraph? The website must be configured with Anonymous access. That is
one requirement I can not change. KB articles would help me.
Thanks.
Dave

Friday, February 24, 2012

Best approach to updating remote server?

I have a local production server, and a web server at a remote ISP connected
via a VPN. Both servers are running MS SQL 2000. I wish to do an extract
of data on the production server and update it to the web server daily. The
web server only gets a subset of the information on the production server.
I know I can't be the first to need this so what I am searching for is the
best way to accomplish this. Do I refresh the web server daily (about 500MB
of data)? Should I send each table with an indicator as to
Add/Change/Delete, and write a procedure to import? or is there just another
solution I am overlooking.
Any suggestions would be appreciated.
TIA, MarkHi Mark.
A common approach to achieving this is to create a DTS package that
encapsulates the process, applies business rules to the data etc & then
schedule it to run from the local production server. I've done this with
various ISP hosted SQL databases with fairly good success.
Is your ISP hosted SQL Server dedicated or shared? If dedicated, many
options may open up to you that a shared server might have available.
HTH
Regards,
Greg Linwood
SQL Server MVP
"Mark Butler" <mredhat_nospam@.yahoo.com> wrote in message
news:enU%238d8DEHA.2932@.tk2msftngp13.phx.gbl...
> I have a local production server, and a web server at a remote ISP
connected
> via a VPN. Both servers are running MS SQL 2000. I wish to do an extract
> of data on the production server and update it to the web server daily.
The
> web server only gets a subset of the information on the production server.
> I know I can't be the first to need this so what I am searching for is the
> best way to accomplish this. Do I refresh the web server daily (about
500MB
> of data)? Should I send each table with an indicator as to
> Add/Change/Delete, and write a procedure to import? or is there just
another
> solution I am overlooking.
> Any suggestions would be appreciated.
> TIA, Mark
>

Best approach to sending field names dynamically

Hi,

I have a C# web app that searches my database table using the
following search parameters

Search string, criteria (< =) and the field you want to perform your
search on. My understanding is that stored procedure is the way to go.
What's the best way of doing this using stored procedures. Can I
define a placeholder for the field name?

Ex.
SELECT field1, field2... FROM Table WHERE field1='value1' where field1
and value1 are both sent from code.

If it's not possible then what is the best way to approach this
problem? I see so many searches like that on the internet. I can only
do them with inline SQL and not stored procedure.

Thank you
Maz.(maflatoun@.gmail.com) writes:

Quote:

Originally Posted by

I have a C# web app that searches my database table using the
following search parameters
>
Search string, criteria (< =) and the field you want to perform your
search on. My understanding is that stored procedure is the way to go.
What's the best way of doing this using stored procedures. Can I
define a placeholder for the field name?
>
Ex.
SELECT field1, field2... FROM Table WHERE field1='value1' where field1
and value1 are both sent from code.
>
If it's not possible then what is the best way to approach this
problem? I see so many searches like that on the internet. I can only
do them with inline SQL and not stored procedure.


Yes, these sort of searches are not very easy to do with static SQL.
I have an article on my web site that discusses this topic in detail:
http://www.sommarskog.se/dyn-search.html.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

Thursday, February 16, 2012

Being able to watch different processes from a web server.

I've got a web server that has many connections going to it. When I'm doing
debugging (sometimes I have to debug on the live server - get over it!) I'll
start up profiler to be able to see the exact SQL statement that is being
sent. Problem is, since there are a lot of users on the system and profiler
tracks them all, it just flies by and it's almost impossible to find
anything.
Is there an easy way to track the specific task for me? Remembering that
every time I connect/disconnect I'll get a different connection ID. About
the only thing I can think of is in my web site do something different when
it's me debugging (like log in as a different user) except this would be
heinous to have to go through and change all my code.
Anybody have any suggestions?
TIA - Jeff.
Hello,
Best way is to load the profiler log data in to a table and do the analysis.
As well as take a look into the server side trace.
http://vyaskn.tripod.com/server_side_tracing_in_sql_server.htm
Thanks
Hari
"UJ" <fred@.nowhere.com> wrote in message
news:OZ1vCpyMHHA.4712@.TK2MSFTNGP04.phx.gbl...
> I've got a web server that has many connections going to it. When I'm
> doing debugging (sometimes I have to debug on the live server - get over
> it!) I'll start up profiler to be able to see the exact SQL statement that
> is being sent. Problem is, since there are a lot of users on the system
> and profiler tracks them all, it just flies by and it's almost impossible
> to find anything.
> Is there an easy way to track the specific task for me? Remembering that
> every time I connect/disconnect I'll get a different connection ID. About
> the only thing I can think of is in my web site do something different
> when it's me debugging (like log in as a different user) except this would
> be heinous to have to go through and change all my code.
> Anybody have any suggestions?
> TIA - Jeff.
>
|||I guess I wasn't clear. The problem is that if all of my webservices log in
as the same account, how can I pare it down to just the commands I did?
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:ePZRJuyMHHA.4720@.TK2MSFTNGP03.phx.gbl...
> Hello,
> Best way is to load the profiler log data in to a table and do the
> analysis. As well as take a look into the server side trace.
> http://vyaskn.tripod.com/server_side_tracing_in_sql_server.htm
>
> Thanks
> Hari
> "UJ" <fred@.nowhere.com> wrote in message
> news:OZ1vCpyMHHA.4712@.TK2MSFTNGP04.phx.gbl...
>

Being able to watch different processes from a web server.

I've got a web server that has many connections going to it. When I'm doing
debugging (sometimes I have to debug on the live server - get over it!) I'll
start up profiler to be able to see the exact SQL statement that is being
sent. Problem is, since there are a lot of users on the system and profiler
tracks them all, it just flies by and it's almost impossible to find
anything.
Is there an easy way to track the specific task for me? Remembering that
every time I connect/disconnect I'll get a different connection ID. About
the only thing I can think of is in my web site do something different when
it's me debugging (like log in as a different user) except this would be
heinous to have to go through and change all my code.
Anybody have any suggestions?
TIA - Jeff.Hello,
Best way is to load the profiler log data in to a table and do the analysis.
As well as take a look into the server side trace.
http://vyaskn.tripod.com/server_sid..._sql_server.htm
Thanks
Hari
"UJ" <fred@.nowhere.com> wrote in message
news:OZ1vCpyMHHA.4712@.TK2MSFTNGP04.phx.gbl...
> I've got a web server that has many connections going to it. When I'm
> doing debugging (sometimes I have to debug on the live server - get over
> it!) I'll start up profiler to be able to see the exact SQL statement that
> is being sent. Problem is, since there are a lot of users on the system
> and profiler tracks them all, it just flies by and it's almost impossible
> to find anything.
> Is there an easy way to track the specific task for me? Remembering that
> every time I connect/disconnect I'll get a different connection ID. About
> the only thing I can think of is in my web site do something different
> when it's me debugging (like log in as a different user) except this would
> be heinous to have to go through and change all my code.
> Anybody have any suggestions?
> TIA - Jeff.
>|||I guess I wasn't clear. The problem is that if all of my webservices log in
as the same account, how can I pare it down to just the commands I did?
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:ePZRJuyMHHA.4720@.TK2MSFTNGP03.phx.gbl...
> Hello,
> Best way is to load the profiler log data in to a table and do the
> analysis. As well as take a look into the server side trace.
> http://vyaskn.tripod.com/server_sid..._sql_server.htm
>
> Thanks
> Hari
> "UJ" <fred@.nowhere.com> wrote in message
> news:OZ1vCpyMHHA.4712@.TK2MSFTNGP04.phx.gbl...
>