Showing posts with label user. Show all posts
Showing posts with label user. Show all posts

Wednesday, March 28, 2012

Optimizing Database

I have an application that's allows user input, and is translating it by
stripping out the html tags and also doing some code translations. The user
is able to later edit their input. However it's unfeasible to reverse
translate it back as the logic would be too complicated, and there are
instances where it won't be possible.

So, what I'm thinking to do to speed up performance is to duplicate the user
data, one for native data, and the other for the translated data. When user
edits their input, the native data is shown. When the application is
showing the data in a page, the translated data is shown.

My question is, would it make a performance difference if I store the native
data and the translated data in the same table, or would it be better to
store the cached data in another table?"Shabam" <blislecp@.hotmail.com> wrote in message
news:mcydnQLoHJrXdPvcRVn-tQ@.adelphia.com...
>I have an application that's allows user input, and is translating it by
> stripping out the html tags and also doing some code translations. The
> user
> is able to later edit their input. However it's unfeasible to reverse
> translate it back as the logic would be too complicated, and there are
> instances where it won't be possible.
> So, what I'm thinking to do to speed up performance is to duplicate the
> user
> data, one for native data, and the other for the translated data. When
> user
> edits their input, the native data is shown. When the application is
> showing the data in a page, the translated data is shown.
> My question is, would it make a performance difference if I store the
> native
> data and the translated data in the same table, or would it be better to
> store the cached data in another table?

It's not easy to say, without any information about the table structure,
data types, indexes, number of rows, query patterns etc. Splitting the table
is unlikely to have any impact by itself, unless perhaps you put the new
tables on different filegroups on different physical disks.

If you have performance issues, are you sure that I/O is the limiting
factor? Have you reviewed the query plans and used Profiler to look for
bottlenecks? You might also want to feed a Profiler trace into the Index
Tuning Wizard to see if it recommends an alternative indexing strategy.

Simon

Wednesday, March 21, 2012

Optimization Required for User Defined Function

Hi,

I've an UDF which inside has two query joined by union and it 's similar to this

select * from Table1 ... (several conditions)
union
select * from Table2 ... (several conditions) (this could takes long time to run)

Since i can't write dynamic sql into UDF , i can't avoid to insert Table2 into the query but to improve permormance I've seen how costant can help me.
For Example if I change my UDF in

select * from Table1 ... (several conditions)
union
select * from Table2 Where 1=2 AND (several conditions)

Optimazer is able to skip completely the second execution, so i need to transform 1=2 into a dynamic condition for example test a field table existence.
select * from Table2 Where Exist (select * from Table3 where Field1=1)

That is why i try to write a single UDF can adapt itself to several situations using second condition only where is necessary and not always.
The problem is the dynamic condition for simple could be, wasn't recognize as costant.

For Example
select top 1 * from MyTable where (select 1)=2
select top 1 * from MyTable where 1=2

If you see the execution plan of these 2 queries you could see that the first takes more than 80% of execution time and in the second less than 20%.
Moreover the second plan use a costant scan unlike the first doesn't it.

Do anyone know a way to tell to optimizer to use a simple condition as constant ? This improve drastically my UDF performance.... :( :(

Thanks.1) why is it essential to make it a function and not procedure or view.
2) how do u find

..you could see that the first takes more than 80% of execution time and in the second less than 20%...

if u r referring to execution-plan these % values relative to the batch and does not represent an absolute value. and practically both are taking 0 sec in my machine.
3) if u use "select" in a "where" it is evaluated once for each row of the outer query hence is inefficient.

Optimization job failing

I have scheduled the optimization job to run everyday and sometimes it fails.
I get this:
Executed as user: test\test. ConnectionCheckForData (CheckforData()).
{SQLSTATE 01000} (Message 10054) General network error. Check your network
documentation. {SQLSTATE 08S01} (Error 11). The step failed.
It does not fail every night. I had it scheduled to run once a week, but it
was taken a long time to run so I thought I would run it more often to reduce
the time.
Also, I notice that when the optimization job is running the transaction log
backup fails.
Any help would be greatly appreciated.
Thank you!
Are you having network problems sporadically? Run ping -t all night several
nights in a row (dump to a text file) and see if you have any 'blips" in
connectivity.
"Orn" wrote:

> I have scheduled the optimization job to run everyday and sometimes it fails.
> I get this:
> Executed as user: test\test. ConnectionCheckForData (CheckforData()).
> {SQLSTATE 01000} (Message 10054) General network error. Check your network
> documentation. {SQLSTATE 08S01} (Error 11). The step failed.
> It does not fail every night. I had it scheduled to run once a week, but it
> was taken a long time to run so I thought I would run it more often to reduce
> the time.
> Also, I notice that when the optimization job is running the transaction log
> backup fails.
> Any help would be greatly appreciated.
> Thank you!
|||ok, i will try that.
Can you tell me what the network would have to do with an optimization job
running locally on the SQL server?
Thank you.
"Donna Lambert" wrote:
[vbcol=seagreen]
> Are you having network problems sporadically? Run ping -t all night several
> nights in a row (dump to a text file) and see if you have any 'blips" in
> connectivity.
>
> "Orn" wrote:
sql

Optimization job failing

I have scheduled the optimization job to run everyday and sometimes it fails
.
I get this:
Executed as user: test\test. ConnectionCheckForData (CheckforData()).
{SQLSTATE 01000} (Message 10054) General network error. Check your netw
ork
documentation. {SQLSTATE 08S01} (Error 11). The step failed.
It does not fail every night. I had it scheduled to run once a week, but it
was taken a long time to run so I thought I would run it more often to reduc
e
the time.
Also, I notice that when the optimization job is running the transaction log
backup fails.
Any help would be greatly appreciated.
Thank you!Are you having network problems sporadically? Run ping -t all night several
nights in a row (dump to a text file) and see if you have any 'blips" in
connectivity.
"Orn" wrote:

> I have scheduled the optimization job to run everyday and sometimes it fai
ls.
> I get this:
> Executed as user: test\test. ConnectionCheckForData (CheckforData()).
> {SQLSTATE 01000} (Message 10054) General network error. Check your ne
twork
> documentation. {SQLSTATE 08S01} (Error 11). The step failed.
> It does not fail every night. I had it scheduled to run once a week, but
it
> was taken a long time to run so I thought I would run it more often to red
uce
> the time.
> Also, I notice that when the optimization job is running the transaction l
og
> backup fails.
> Any help would be greatly appreciated.
> Thank you!|||ok, i will try that.
Can you tell me what the network would have to do with an optimization job
running locally on the SQL server?
Thank you.
"Donna Lambert" wrote:
[vbcol=seagreen]
> Are you having network problems sporadically? Run ping -t all night sever
al
> nights in a row (dump to a text file) and see if you have any 'blips" in
> connectivity.
>
> "Orn" wrote:
>

Optimization job failing

I have scheduled the optimization job to run everyday and sometimes it fails.
I get this:
Executed as user: test\test. ConnectionCheckForData (CheckforData()).
{SQLSTATE 01000} (Message 10054) General network error. Check your network
documentation. {SQLSTATE 08S01} (Error 11). The step failed.
It does not fail every night. I had it scheduled to run once a week, but it
was taken a long time to run so I thought I would run it more often to reduce
the time.
Also, I notice that when the optimization job is running the transaction log
backup fails.
Any help would be greatly appreciated.
Thank you!Are you having network problems sporadically? Run ping -t all night several
nights in a row (dump to a text file) and see if you have any 'blips" in
connectivity.
"Orn" wrote:
> I have scheduled the optimization job to run everyday and sometimes it fails.
> I get this:
> Executed as user: test\test. ConnectionCheckForData (CheckforData()).
> {SQLSTATE 01000} (Message 10054) General network error. Check your network
> documentation. {SQLSTATE 08S01} (Error 11). The step failed.
> It does not fail every night. I had it scheduled to run once a week, but it
> was taken a long time to run so I thought I would run it more often to reduce
> the time.
> Also, I notice that when the optimization job is running the transaction log
> backup fails.
> Any help would be greatly appreciated.
> Thank you!|||ok, i will try that.
Can you tell me what the network would have to do with an optimization job
running locally on the SQL server?
Thank you.
"Donna Lambert" wrote:
> Are you having network problems sporadically? Run ping -t all night several
> nights in a row (dump to a text file) and see if you have any 'blips" in
> connectivity.
>
> "Orn" wrote:
> > I have scheduled the optimization job to run everyday and sometimes it fails.
> > I get this:
> >
> > Executed as user: test\test. ConnectionCheckForData (CheckforData()).
> > {SQLSTATE 01000} (Message 10054) General network error. Check your network
> > documentation. {SQLSTATE 08S01} (Error 11). The step failed.
> >
> > It does not fail every night. I had it scheduled to run once a week, but it
> > was taken a long time to run so I thought I would run it more often to reduce
> > the time.
> >
> > Also, I notice that when the optimization job is running the transaction log
> > backup fails.
> >
> > Any help would be greatly appreciated.
> >
> > Thank you!

Monday, March 19, 2012

Optimising Select statements which has a LIKE where clause.

Hi all

I have been doing some development work in a large VB6 application. I have updated the search capabilities of the application to allow the user to search on partial addresses as the existing search routine only allowed you to search on the whole line of the address.

Simple change to the stored procedure (this is just an example not the real stored proc):

From:
Select Top 3000 * from TL_ClientAddresses with(nolock) Where strPostCode = W1 ABC
To:
Select Top 3000 * from TL_ClientAddresses with(nolock) Where strPostCode LIKE W1%

Now this is when things went a bit crazy. I know the implications of using with(nolock). But seeing the code is only using the ID field to get the required row, and the database is a live database with hundreds of users at any one time (some updating), I think a dirty read is ok in this routine, as I dont want SQL to create a shared lock.

Anyway my problem is this. After the change, the search now created a Shared Lock which sometimes locks out some of the live users updating the system. The Select is also extremely SLOW. It took about 5 minutes to search just over a million records (locking the database during the search, and giving my manager good reason to shout abuse at me). So I checked the indexes. I had an index set on:

strAddressLine1, strAddressLine2, strAddressLine3, strAddressLine4, strPostCode.

So I created an index just for the strPostCode (non clustered).

This had no change to the Like select what so ever. So I am now stuck.

1) Is there another way to search for part of a text field in SQL.
2) Does Like comparison use the index in any way? If so how do I set this index up?
3) Can I stop a Shared Lock being created when I do a like select?
4) Do you have any good comebacks I could tell the boss after his next outburst of abuse (please not so bad that he sacks me).

Any advice truly appreciated.1. I have been working on smaller database systems the last couple of years but as for number 1 try changing the query to "=" with a wild card "%" in the QA with the show execution plan on and see if the index is being used.

2. I seem to remember that the like operator cancels the index. To check this I would execute the query in the QA and check the execution plan.

3. Don't know off the top of my head.

4. Tell your boss that software like the people who create it are imperfect things.|||Like is one of those "fuzzy" things and does not use indexes. Postcodes are notoriously difficult to search on...

In your example you give "W1%"

realise that this will return W12 etc

I in the time I had to do this tried to Narrow the user down to the local as in W1
W12 etc

Alternative prospect here

Split your Postcode into two fields (I know it sounds wierd) but then you can do an = rather than a like and an index can be used!|||I'd try to run the query in the Query Analyzer. In the form that you posted the query, it ought to use the PostCode index. It ought to be able to ride the index as far as the first wildcard (percent sign in this case). If you examine the query plan, it might give you some idea of where the problem is.

-PatP|||I get an index seek with a bookmark lookup

USE Northwind
GO

SET NOCOUNT ON
CREATE TABLE myTable99(strPostCode varchar(10), Col2 int)
GO

INSERT INTO myTable99(strPostCode, Col2)
SELECT 'W1Me',1 UNION ALL
SELECT 'W2Me',2 UNION ALL
SELECT 'W3Me',3 UNION ALL
SELECT 'W4Me',4
GO

CREATE INDEX myTable99_strPostCode ON myTable99(strPostCode)
GO

--[CTRL]+K
Select Top 3000 * from myTable99 with(nolock) Where strPostCode LIKE 'W1%'
GO

SET NOCOUNT OFF
GO|||Yeah, but that's using the code that they posted, which might or might not generate the same plan as the code they are actually using ;) Not that I've ever been burned by different code being posted than what is actually run before, I just read about it in this book once...

-PatP|||First like to thank everyone who replied. Very much appreciated.

Unfortunately I am still not much closer at finding a solution. I have done the execution plan thing although I can see a index seek, I dont think the index I have created is being used (but I am not sure).

If I delete the index, then the search time on about 500,000 records (Im testing from a subset of the total number of rows in the table) is about the same as when the index is present. If I do a = search, then with an index runs in less than a second and without takes much longer.

Anyway if anyone has any other ideas or a total different approach I can take then please let me know. Also if anyone knows of any websites or books that look into like selects more deeply than just giving you the syntax, like every book and site I have found, then that would be good too.

Regards

Eamon.|||1. Try use index hint:
Select Top 3000 * from TL_ClientAddresses with(nolock, INDEX (your_index_name)) Where strPostCode LIKE W1%
2. Try update statistics:
EXEC sp_updatestats
3. Try change query:
Select Top 3000 * from TL_ClientAddresses with(nolock)
Where strPostCode >= W1 AND strPostCode =< W1z
4. If your query fetch more then 20% table then optimizer don't use index|||mwolf! Your a Star!!!

Select Top 3000 * from TL_ClientAddresses with(nolock, INDEX (your_index_name)) Where strPostCode LIKE W1%

Works a treat!!! Gone from over a minute down to 6 seconds just by adding the 'INDEX()' statement.

I think that's the answer to my problem, Thankyou very much!!!

Regards

Eamon.

Monday, March 12, 2012

optimal location for database files on SAN?

Hi, we have 2 sql servers that will have all their system databases/user
databases/log files located to a san. what is the best configuration?
note: sql1 performs transactional replication to sql2 (which is used for
reporting):
we have 2 x RAID 1 and 1 x RAID 5. I was thinking:
RAID 1: sql2 user + system data files
RAID 1: Logs (from both sql1 and sql2)
RAID 5: sql1 user + system data files
if I could get access to another RAID 1 how would this sound:
RAID 1: sql2 user + system data files
RAID 1: Logs (from both sql1 and sql2)
RAID 1: tempdb (from both sql1 and sql2)
RAID 5: sql1 user + system data files
Would both servers share the same tempdb? or would there be two instances?
since sql1 replicates to sql2, having all the logs on the same RAID 1 would
increase replication speed?
Any help most appreciated!
thanks, johni will have access to initially 9 hdd's to build my config, but i might
possibly get a hold of more. any help most appreciated! ciao john
"john r" <johnr@.trailer.com> wrote in message
news:uSqTyAS6FHA.2364@.TK2MSFTNGP12.phx.gbl...
> Hi, we have 2 sql servers that will have all their system databases/user
> databases/log files located to a san. what is the best configuration?
> note: sql1 performs transactional replication to sql2 (which is used for
> reporting):
> we have 2 x RAID 1 and 1 x RAID 5. I was thinking:
> RAID 1: sql2 user + system data files
> RAID 1: Logs (from both sql1 and sql2)
> RAID 5: sql1 user + system data files
> if I could get access to another RAID 1 how would this sound:
> RAID 1: sql2 user + system data files
> RAID 1: Logs (from both sql1 and sql2)
> RAID 1: tempdb (from both sql1 and sql2)
> RAID 5: sql1 user + system data files
> Would both servers share the same tempdb? or would there be two instances?
> since sql1 replicates to sql2, having all the logs on the same RAID 1
> would increase replication speed?
> Any help most appreciated!
> thanks, john
>|||I am not sure if I hit enter or lost the page. I tried an earlier response
Anyway, I suggest Mirroring your OS drive and a Binaries Drive witht the SAN
used for all the data files.
I like mirroring, but that is a bias others will contest.
Without knowing your SAN, I can't say much more. Some SANs don't give you
enough control to worry about RAID levels.
The real question is how many LUNs to the SAN?
--
Joseph R.P. Maloney, CSP,CCP,CDP
"john r" wrote:
> i will have access to initially 9 hdd's to build my config, but i might
> possibly get a hold of more. any help most appreciated! ciao john
>
> "john r" <johnr@.trailer.com> wrote in message
> news:uSqTyAS6FHA.2364@.TK2MSFTNGP12.phx.gbl...
> > Hi, we have 2 sql servers that will have all their system databases/user
> > databases/log files located to a san. what is the best configuration?
> >
> > note: sql1 performs transactional replication to sql2 (which is used for
> > reporting):
> >
> > we have 2 x RAID 1 and 1 x RAID 5. I was thinking:
> >
> > RAID 1: sql2 user + system data files
> > RAID 1: Logs (from both sql1 and sql2)
> > RAID 5: sql1 user + system data files
> >
> > if I could get access to another RAID 1 how would this sound:
> >
> > RAID 1: sql2 user + system data files
> > RAID 1: Logs (from both sql1 and sql2)
> > RAID 1: tempdb (from both sql1 and sql2)
> > RAID 5: sql1 user + system data files
> >
> > Would both servers share the same tempdb? or would there be two instances?
> >
> > since sql1 replicates to sql2, having all the logs on the same RAID 1
> > would increase replication speed?
> >
> > Any help most appreciated!
> > thanks, john
> >
>
>|||The primary question for me is how many LUNs do you have.
I like Raid 0+1 (mirroring) rather than Raid-5 and all. Personal bias.
I would look to configure as follows:
Logical C: Mirror, OS files
Logical D: Mirror, Application (including SS) binaries
Logical E; SAN-data and log files.
This presumes 1 LUN, probably fiber, to the SAN.
As I said, I like mirroring. Without knowing which SAN you are using,
though, it is difficult to give advice (foot in mouth?) there. Some SANS do
not give you
--
Joseph R.P. Maloney, CSP,CCP,CDP
"john r" wrote:
> i will have access to initially 9 hdd's to build my config, but i might
> possibly get a hold of more. any help most appreciated! ciao john
>
> "john r" <johnr@.trailer.com> wrote in message
> news:uSqTyAS6FHA.2364@.TK2MSFTNGP12.phx.gbl...
> > Hi, we have 2 sql servers that will have all their system databases/user
> > databases/log files located to a san. what is the best configuration?
> >
> > note: sql1 performs transactional replication to sql2 (which is used for
> > reporting):
> >
> > we have 2 x RAID 1 and 1 x RAID 5. I was thinking:
> >
> > RAID 1: sql2 user + system data files
> > RAID 1: Logs (from both sql1 and sql2)
> > RAID 5: sql1 user + system data files
> >
> > if I could get access to another RAID 1 how would this sound:
> >
> > RAID 1: sql2 user + system data files
> > RAID 1: Logs (from both sql1 and sql2)
> > RAID 1: tempdb (from both sql1 and sql2)
> > RAID 5: sql1 user + system data files
> >
> > Would both servers share the same tempdb? or would there be two instances?
> >
> > since sql1 replicates to sql2, having all the logs on the same RAID 1
> > would increase replication speed?
> >
> > Any help most appreciated!
> > thanks, john
> >
>
>|||I believe it is going to depend on the size of your databases and what they
are used for. Are they creating a lot of temp tables in the temp database?
if so, then temp needs two RAID1 volumes, 1 for data, 1 for logs.
Also, whatever config you end up with, separate the log files from the data
files.
Another thing to consider if you have it available is to use RAID1 or RAID10
on your databases. RAID5 is too expensive on the write operation for your
heavily used databases.
I hope this helps.
"john r" <johnr@.trailer.com> wrote in message
news:uSqTyAS6FHA.2364@.TK2MSFTNGP12.phx.gbl...
> Hi, we have 2 sql servers that will have all their system databases/user
> databases/log files located to a san. what is the best configuration?
> note: sql1 performs transactional replication to sql2 (which is used for
> reporting):
> we have 2 x RAID 1 and 1 x RAID 5. I was thinking:
> RAID 1: sql2 user + system data files
> RAID 1: Logs (from both sql1 and sql2)
> RAID 5: sql1 user + system data files
> if I could get access to another RAID 1 how would this sound:
> RAID 1: sql2 user + system data files
> RAID 1: Logs (from both sql1 and sql2)
> RAID 1: tempdb (from both sql1 and sql2)
> RAID 5: sql1 user + system data files
> Would both servers share the same tempdb? or would there be two instances?
> since sql1 replicates to sql2, having all the logs on the same RAID 1
> would increase replication speed?
> Any help most appreciated!
> thanks, john
>

Friday, March 9, 2012

Opinios: SQL DB Dev MCP Exam 70-229

I'm terrified, and could use some opinions from the user community...
I'm about to take my first ever Microsoft MCP exam on SQL Server 2000
Development (70-229). To prepare, I've been reading the SQL Server 2000
Design Exam Study Guide from Sybex Books.
One of the problems I have is with ambiguously-worded questions. One example
is this:
You have data stored in SQL Server and Oracle. Occasionally, you need to
access data from both sources as a single result set. How should you do this
?
A. Add the Oracle server as a linked server.
B. Use the DTS Import Wizard to import the data from Oracle into SQL Server.
C. Use the OPENROWSET function to access the Oracle data.
D. Export the data from Oracle to a text file, and import it into SQL Server
using BULK INSERT.
Now, although it seems all 4 technically would work, the obvious first step
is to narrow it down to A and C (B and D are too cumbersome).
Linked servers should be used if the data is accessed FREQUENTLY. OPENROWSET
should be used if the data is accessed INFREQUENTLY. I have a full
understanding of that concept.
How often is "occasionally," as it is worded in the question?
In my world,
Frequently = 90% of the time
Infrequntly = 10% of the time
Occasionally = 30 - 50% of the time.
The only other guideline I have is elsewhere in the book, where it states in
a big NOTE area:
"If access to a data source is needed more than a handful of times, the
source should be registered with SQL Server" a.k.a. linked table.
Is "occasional" more than a "handful?"
I thought so. I said Linked Server. The Sybex author thinks "occasional" =
"infrquent," and that the correct answer is OPENROWSET.
I got the question wrong. Or so says Sybex.
Here's my question for opinions: For those who have taken this MCP exam, do
the Microsoft authors word the questions on the MCP exam as ambiguously as
the authors from Sybex?
It seems if the question has a black-and-white right-and-wrong answer, then
the question should have a more black-and-white wording, and not use words
like "occasional," that different people will interpret differently.
Ultimately, I'm afraid I will get questions wrong, not because of lack of
understanding of the subject matter, but from ambiguous wording of the
questions. Are the Microsoft questions this loosely worded?
Thanks!If you are prepared, most of the questions on the exam will appear to you to
have only one correct answer. The sample question you provided is poorly
written and misleading (In addition to being an MCDBA, I tought at colleges
for about 5 years). I have used Sybex books for other certifications, and I
think that it is a pattern with their products. Although the main text may b
e
well-written by a reputable author, very often the question banks are writte
n
by someone else. Even so, the question may have served its purpose by gettin
g
you to research and think about the answer, even though your answer wasn't
"right."
That being said, you probably will encounter at least one question during
the exam that seems to have either no or multiple correct answers. It might
be a "throw away" question placed on your exam to test the *question* for
usability in later exams.
In addition to your technical studying routine, I would also recommend
looking at some resources for dealing with test anxiety; you're opening of
"I'm terrified" give you away :-) . Good luck!
"Joel" wrote:

> I'm terrified, and could use some opinions from the user community...
> I'm about to take my first ever Microsoft MCP exam on SQL Server 2000
> Development (70-229). To prepare, I've been reading the SQL Server 2000
> Design Exam Study Guide from Sybex Books.
> One of the problems I have is with ambiguously-worded questions. One examp
le
> is this:
> You have data stored in SQL Server and Oracle. Occasionally, you need to
> access data from both sources as a single result set. How should you do th
is?
> A. Add the Oracle server as a linked server.
> B. Use the DTS Import Wizard to import the data from Oracle into SQL Serve
r.
> C. Use the OPENROWSET function to access the Oracle data.
> D. Export the data from Oracle to a text file, and import it into SQL Serv
er
> using BULK INSERT.
> Now, although it seems all 4 technically would work, the obvious first ste
p
> is to narrow it down to A and C (B and D are too cumbersome).
> Linked servers should be used if the data is accessed FREQUENTLY. OPENROWS
ET
> should be used if the data is accessed INFREQUENTLY. I have a full
> understanding of that concept.
> How often is "occasionally," as it is worded in the question?
> In my world,
> Frequently = 90% of the time
> Infrequntly = 10% of the time
> Occasionally = 30 - 50% of the time.
> The only other guideline I have is elsewhere in the book, where it states
in
> a big NOTE area:
> "If access to a data source is needed more than a handful of times, the
> source should be registered with SQL Server" a.k.a. linked table.
> Is "occasional" more than a "handful?"
> I thought so. I said Linked Server. The Sybex author thinks "occasional" =
> "infrquent," and that the correct answer is OPENROWSET.
> I got the question wrong. Or so says Sybex.
> Here's my question for opinions: For those who have taken this MCP exam, d
o
> the Microsoft authors word the questions on the MCP exam as ambiguously as
> the authors from Sybex?
> It seems if the question has a black-and-white right-and-wrong answer, the
n
> the question should have a more black-and-white wording, and not use words
> like "occasional," that different people will interpret differently.
> Ultimately, I'm afraid I will get questions wrong, not because of lack of
> understanding of the subject matter, but from ambiguous wording of the
> questions. Are the Microsoft questions this loosely worded?
> Thanks!|||Joel,
First off, good luck on the exams. Second, I have written a score of books
for Sybex, (The SQL 2k Admin guide being one of them, Note: I did not write
the Development Guide).
The sample questions in the books are of two varieties. One set is to
ensure that you have specific knowledge about the subject. The second set
of questions will have a similar look and feel to the live questions on the
exam.
As far as ambiguity is concerned, the example you gave below could be
construed as ambiguous unless you have read the chapters carefully. In the
Admin book, we would normally discuss what is "occasional usage" or "a
handful of times" in the same set of paragraphs where we discuss the
OPENROWSET command. It should give you a mental link between those words
(occasional usage, handful of times) and OPENROWSET. Likewise, in the
Linked Server section it should discuss with words like "frequent" and
"often".
In addition to the Sybex books, I would suggest you purchase and go through
some sample exams. MeasureUp and Transcender do a pretty good job of test
prepping you with questions. They tell you why the correct answer is
correct and more importantly why the incorrect answers don't match the
questions. (This information will give you much broader depth of knowledge
about the subject as most answers are TRUE statements, but don't necessarily
apply to the question given.)
Some information about the questions themselves. In general, you need to
read the question carefully and pick the answer which correctly solves the
QUESTION as given. You will find that in most cases, the answers provided
will all be TRUE statements about SQL Server, but only the correct answer
will apply to the question given.
In some instances (as you have shown below), all the solutions given could
successfully answer the question, but from that you need to cull the BEST
solution given the parameters of the question itself. In those situations,
make sure that you factor in what Microsoft thinks is the BEST solution.
As an example, in the real world, a Primary Key should uniquely identify a
single row in a table. A natural key could do that (Like a UPC code for a
product). The Microsoft answer however would be that you should always use
a surrogate key, even if a valid natural key is available. In the real
world you would need to determines the pros and cons of using that UPC code
versus a surrogate.
HTH
Best of luck on the exams!
Rick Sawtell
MCT, MCSD, MCDBA
"Joel" <Joel@.discussions.microsoft.com> wrote in message
news:49E3DB04-9969-4A65-85DB-B82CC92F9BD7@.microsoft.com...
> I'm terrified, and could use some opinions from the user community...
> I'm about to take my first ever Microsoft MCP exam on SQL Server 2000
> Development (70-229). To prepare, I've been reading the SQL Server 2000
> Design Exam Study Guide from Sybex Books.
> One of the problems I have is with ambiguously-worded questions. One
> example
> is this:
> You have data stored in SQL Server and Oracle. Occasionally, you need to
> access data from both sources as a single result set. How should you do
> this?
> A. Add the Oracle server as a linked server.
> B. Use the DTS Import Wizard to import the data from Oracle into SQL
> Server.
> C. Use the OPENROWSET function to access the Oracle data.
> D. Export the data from Oracle to a text file, and import it into SQL
> Server
> using BULK INSERT.
> Now, although it seems all 4 technically would work, the obvious first
> step
> is to narrow it down to A and C (B and D are too cumbersome).
> Linked servers should be used if the data is accessed FREQUENTLY.
> OPENROWSET
> should be used if the data is accessed INFREQUENTLY. I have a full
> understanding of that concept.
> How often is "occasionally," as it is worded in the question?
> In my world,
> Frequently = 90% of the time
> Infrequntly = 10% of the time
> Occasionally = 30 - 50% of the time.
> The only other guideline I have is elsewhere in the book, where it states
> in
> a big NOTE area:
> "If access to a data source is needed more than a handful of times, the
> source should be registered with SQL Server" a.k.a. linked table.
> Is "occasional" more than a "handful?"
> I thought so. I said Linked Server. The Sybex author thinks "occasional" =
> "infrquent," and that the correct answer is OPENROWSET.
> I got the question wrong. Or so says Sybex.
> Here's my question for opinions: For those who have taken this MCP exam,
> do
> the Microsoft authors word the questions on the MCP exam as ambiguously as
> the authors from Sybex?
> It seems if the question has a black-and-white right-and-wrong answer,
> then
> the question should have a more black-and-white wording, and not use words
> like "occasional," that different people will interpret differently.
> Ultimately, I'm afraid I will get questions wrong, not because of lack of
> understanding of the subject matter, but from ambiguous wording of the
> questions. Are the Microsoft questions this loosely worded?
> Thanks!

Opinion about design needed (splitting string data)

Hi to everyone,

My problem is, that I'm not so quite sure, which way should I go.

The user is inputing by second part application a long string (let's
say 128 characters), which are separated by semiclon.
Example:

A20;BU;AC40;MA50;E;E;IC;GREEN

Now: each from this position, is already defined in any other table, as
a separate record. These are the keys lets say. It means, a have some
properities for A20, BU, aso.

Because this long inputed string, is a property of device (whih also
has a lot of different properities) I could do two different ways of
storing data:

1. By writing, in SP, just encapsulate each of the position separated
by semicolon, and write into a different table with index of device,
and the position in long stirng nearly in this way:

Major device data table
ID AnyData1 AnyData2 ... AnyData3
123 MZD12 XX77 ... any comment text
124 MZD13 XY55 ... any other comment

String data Table
fk_deviceId position value
123 1 A20
123 2 BU
123 3 AC40
....
123 8 GREEN

The device table, contains also a pointer (position), which might
change, to "hglight" specified position.

Then, I can very easly find all necessary data. The problem is, I need
to move the device record data (from other table) very often into other
history table (by each update). That will mean, that I also need to
move all these records from 1 -8 for example to a separate history
table, holding the index for a history device dataset. This is a little
inconvinience in this, and in my opinion, it will use to much storage
data, and by programming, I need always to shift this properities into
history table, whith indexes to a history table of other properities.

2. Table will be build nearly in this way:

Major device data table
ID AnyData1 AnyData2 ... AnyData3 stringProperty pointer
123 MZD12 XX77 ... any comment text A20;BU;AC40;MA50;E;E;IC;GREEN 3
124 MZD13 XY55 ... any other comment A20;BU;AC40;MA50;E;E;IC;GREEN 2

By writng into device table, there will be just a additional field for
this string, and I will have a function, which according to specified
pointer, will get me the string part on the fly, while I need it.
This will not require the other table, and will reduce the amout of
data, not a lot ... but always.
This solution, has a inconvinance, that it will be not so fast doing a
search over the part of this strings, while there will be no real index
on this.
If I woould like to search all devices, by which the curent pointer
value is equal GREEN, then I need to use function for getting the
value, and this one will be not indexed, means, by a lot amount of
data, might be slow.

I would like to know Your opinion about booth solutions.
Also, if you might point me the other problems with any of this
solution, I might not have noticed.

With Best Regards

MatikMatik (marzec@.sauron.xo.pl) writes:

Quote:

Originally Posted by

1. By writing, in SP, just encapsulate each of the position separated
by semicolon, and write into a different table with index of device,
and the position in long stirng nearly in this way:
>
Major device data table
ID AnyData1 AnyData2 ... AnyData3
123 MZD12 XX77 ... any comment text
124 MZD13 XY55 ... any other comment
>
String data Table
fk_deviceId position value
123 1 A20
123 2 BU
123 3 AC40
...
123 8 GREEN
>
The device table, contains also a pointer (position), which might
change, to "hglight" specified position.


This is the normal design in this situation.

Quote:

Originally Posted by

Major device data table
ID AnyData1 AnyData2 ... AnyData3 stringProperty pointer
123 MZD12 XX77 ... any comment text A20;BU;AC40;MA50;E;E;IC;GREEN 3
124 MZD13 XY55 ... any other comment A20;BU;AC40;MA50;E;E;IC;GREEN 2


This design violates a basic principle in relational design: no repeating
groups.

Every rule is made to break, and I have occasionally put repeating groups in
the database I maintain, but this is a clearcut case: don't even think
about it. This sort of data is very difficult to work with in a
relational database, simply because it's not meant that you should
store data in this way.

Quote:

Originally Posted by

Then, I can very easly find all necessary data. The problem is, I need
to move the device record data (from other table) very often into other
history table (by each update). That will mean, that I also need to
move all these records from 1 -8 for example to a separate history
table, holding the index for a history device dataset. This is a little
inconvinience in this, and in my opinion, it will use to much storage
data,


With a sub-table you need to repeat the ID. There will also be a cost
of two bytes for the length of each column. There is also the cost for
the field number, but since you don't have any semi-colon, this is a
net cost of one byte. There is also some overhead for each row. But
all and all, I would say that the overhead is about neglible.

Quote:

Originally Posted by

and by programming, I need always to shift this properities into
history table, whith indexes to a history table of other properities.


Don't really know what you mean here.

For completeness sake I should say that there is a third alternative,
and that is one table, but eight columns. This could also be considered
a repeating group. Then again, if the different fields represents
different attributes, it isn't really an repetition. This solution
is better my opinion than a seprated list, but the pointer you talk
about may be more difficult to implement.

--
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|||Erland Sommarskog wrote:

Quote:

Originally Posted by

Matik (marzec@.sauron.xo.pl) writes:


Quote:

Originally Posted by

Quote:

Originally Posted by

>and by programming, I need always to shift this properities into
>history table, whith indexes to a history table of other properities.


>
Don't really know what you mean here.


Probably something along the lines of: (oversimplified for brevity)

insert into FooHistory select * from CurrentFoo
delete from CurrentFoo|||Then maybe you could create a view for the second table.

Matik wrote:

Quote:

Originally Posted by

Hi to everyone,
>
My problem is, that I'm not so quite sure, which way should I go.
>
The user is inputing by second part application a long string (let's
say 128 characters), which are separated by semiclon.
Example:
>
A20;BU;AC40;MA50;E;E;IC;GREEN
>
Now: each from this position, is already defined in any other table, as
a separate record. These are the keys lets say. It means, a have some
properities for A20, BU, aso.
>
Because this long inputed string, is a property of device (whih also
has a lot of different properities) I could do two different ways of
storing data:
>
1. By writing, in SP, just encapsulate each of the position separated
by semicolon, and write into a different table with index of device,
and the position in long stirng nearly in this way:
>
Major device data table
ID AnyData1 AnyData2 ... AnyData3
123 MZD12 XX77 ... any comment text
124 MZD13 XY55 ... any other comment
>
String data Table
fk_deviceId position value
123 1 A20
123 2 BU
123 3 AC40
...
123 8 GREEN
>
The device table, contains also a pointer (position), which might
change, to "hglight" specified position.
>
Then, I can very easly find all necessary data. The problem is, I need
to move the device record data (from other table) very often into other
history table (by each update). That will mean, that I also need to
move all these records from 1 -8 for example to a separate history
table, holding the index for a history device dataset. This is a little
inconvinience in this, and in my opinion, it will use to much storage
data, and by programming, I need always to shift this properities into
history table, whith indexes to a history table of other properities.
>
2. Table will be build nearly in this way:
>
Major device data table
ID AnyData1 AnyData2 ... AnyData3 stringProperty pointer
123 MZD12 XX77 ... any comment text A20;BU;AC40;MA50;E;E;IC;GREEN 3
124 MZD13 XY55 ... any other comment A20;BU;AC40;MA50;E;E;IC;GREEN 2
>
By writng into device table, there will be just a additional field for
this string, and I will have a function, which according to specified
pointer, will get me the string part on the fly, while I need it.
This will not require the other table, and will reduce the amout of
data, not a lot ... but always.
This solution, has a inconvinance, that it will be not so fast doing a
search over the part of this strings, while there will be no real index
on this.
If I woould like to search all devices, by which the curent pointer
value is equal GREEN, then I need to use function for getting the
value, and this one will be not indexed, means, by a lot amount of
data, might be slow.
>
I would like to know Your opinion about booth solutions.
Also, if you might point me the other problems with any of this
solution, I might not have noticed.
>
With Best Regards
>
Matik

|||First of all, thank you for your reply!

Now, some additional explenations maybe:

That was just an example, with 8 positions separated by semicolon as a
one property. The problem is, there number of this is various. That's
why, I couldyn't solve issue with fix number of column.

With shifting data into history, I've ment, that by each change of data
in primary table, whole record should be copied to the history table
(nearly same construction as primary table).
This is than an issue with the second table, storing semicolon
separated field in one column (splitted) in different table. This need
to be shifted then also, to a second historical table.

Of course, I could ommit using 'working' table, and have only history,
with inserts, and having a primary table containing a pointer to last -
newest record as my primary table, to get the newest record.
The problem is, I'm afraid a little of performance, sice there is all
other actions done on the primary table (select, searches aso.)
Having a big historical table, I will still need to get countinous
joins, to get the newest record, and even having a good indexing and
relation set up, it might be slow while table can be big.

This semicolon devided string, as example was shown pretty simmilar,
but it can be also various:

A10;B13;c20;bubu;lala;GREEN;RED
A13;BUBU;GREEN;YELLOW;mama
C25;YELLOW
BLUE;pleple;B13
aso.

The pointer I was talking about, is just a index, to which position in
this semicolon devided string, is curently activated.

Best regards

Matik|||Matik wrote:

Quote:

Originally Posted by

The problem is, I'm afraid a little of performance,


This has "premature optimization" written all over it. Build the
database cleanly first; then, if you /actually/ have performance
issues, then consider how to improve it (but breaking 1NF with "a;b;c"
type columns should still be a last resort).|||Matik (marzec@.sauron.xo.pl) writes:

Quote:

Originally Posted by

With shifting data into history, I've ment, that by each change of data
in primary table, whole record should be copied to the history table
(nearly same construction as primary table).
This is than an issue with the second table, storing semicolon
separated field in one column (splitted) in different table. This need
to be shifted then also, to a second historical table.


I'm not sure that I see the problem. With a regular design, you would
have two tables for current data, and two tables for historical data.

Quote:

Originally Posted by

Of course, I could ommit using 'working' table, and have only history,
with inserts, and having a primary table containing a pointer to last -
newest record as my primary table, to get the newest record.
The problem is, I'm afraid a little of performance, sice there is all
other actions done on the primary table (select, searches aso.)


Like Ed said, get the design right first, and do performance tuning
when everything else is working. But some basic ideas for performance
are good when designing for performance. For instance no repeating
groups (i.e. semicolon-separated lists.)

--
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|||Matik wrote:

Quote:

Originally Posted by

>
Of course, I could ommit using 'working' table, and have only history,
with inserts, and having a primary table containing a pointer to last -
newest record as my primary table, to get the newest record.
The problem is, I'm afraid a little of performance, sice there is all
other actions done on the primary table (select, searches aso.)
Having a big historical table, I will still need to get countinous
joins, to get the newest record, and even having a good indexing and
relation set up, it might be slow while table can be big.
>


The way to optimise is with good indexes and good query design. You say
"it might be slow" so obviously you haven't reached that stage yet. On
the other hand you know for sure that a redundant copy of the data will
have an additional performance cost, both for updates and queries.

--
David Portas, SQL Server MVP

Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.

SQL Server Books Online:
http://msdn2.microsoft.com/library/...US,SQL.90).aspx
--

Wednesday, March 7, 2012

Operation is not valid due to the current state of the object

Hello,

We are getting this error when a user clients any report. they can see the directories OK, but when we upload a new report the error still happens.

Error is "Operation is not valid due to the current state of the object."

Any ideas?

Thanks

Michael

Hi Michael,

I am also getting the same error whenever I tried to open a report through browser. Please let me know if you have resolved this issue and the fix for the same.

Thanks & Regards,

Sathya

|||

This was address in a previous forum by Brian Hartman, I have provided you with a link:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=212322&SiteID=1

Ham

Operation is not valid due to the current state of the object

Hello,

We are getting this error when a user clients any report. they can see the directories OK, but when we upload a new report the error still happens.

Error is "Operation is not valid due to the current state of the object."

Any ideas?

Thanks

Michael

Hi Michael,

I am also getting the same error whenever I tried to open a report through browser. Please let me know if you have resolved this issue and the fix for the same.

Thanks & Regards,

Sathya

|||

This was address in a previous forum by Brian Hartman, I have provided you with a link:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=212322&SiteID=1

Ham

Operation cancelled by user

Hello Guys,

I am currently experiencing a Sql error: operation cancelled by user.

I don't know where this error come from. Is it from ADO.NET or SQL Server 2000.

This error doesn't always occur. It only occurs when many users access the web site. I want to know who issue the error. Why issue the error.

Let me know if you have any ideas

Thanks in advanced

See if the following post helps

http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework.adonet/topic10278.aspx

|||

Hi Raj Kasi,

Thanks for replying. I did not use sqlcommand.cancel(). Also, the error occurs before I call the finally.

Here is my code:

Dim sqlConnection As New sqlConnection(ConfigurationSettings.AppSettings(String.Format("db.{0}.SQLconnString", Env)))

Dim sbTable As New StringBuilder

Dim strCmpy As String

Dim tblCounters As String

strCmpy = Server.UrlDecode(Request.Cookies("Companies").Value)

Dim sqlCommand As New sqlCommand("sp_getCompanyInfo", sqlConnection)

Dim sqlDataReader As sqlDataReader

Dim myParam As SqlParameter

Dim errLog As New errReport

Try

sqlCommand.CommandType = CommandType.StoredProcedure

sqlConnection.Open()

myParam = sqlCommand.Parameters.Add("@.Companies", SqlDbType.VarChar, 50)

myParam.Value = strCmpy

myParam = sqlCommand.Parameters.Add("@.Class", SqlDbType.VarChar, 2)

myParam.Value = selClass

myParam = sqlCommand.Parameters.Add("@.BrchTmpl", SqlDbType.VarChar, 6)

myParam.Value = selBrchTmpl

sqlDataReader = sqlCommand.ExecuteReader()

Catch ex As Exception

errLog.reportError("Error=" & ex.ToString())

Finally

If Not sqlCommand Is Nothing Then

If Not sqlConnection Is Nothing AndAlso sqlConnection.State <> ConnectionState.Closed Then

sqlCommand.Close()

End If

sqlCommand.Dispose()

End If

If Not sqlConnection Is Nothing Then sqlConnection.Dispose()

End Try

The error occurs when I call sqlCommand.ExecuteReader(). This error only occurs when many users come to use my asp.net application. I use asp.net 1.1 on windows 2000 server framework 1.1 with IIS 6.0.

Thanks

Troy123

|||

Hi Troy123,

Could you see if hitting "stop" or navigating away from the page during operation reproduces this problem? You may need to specify how you treat people navigating away from the page to ensure that it does not kill the back end process explicitly (or maybe you want that to lower the load on your server).

Hope something comes of this,

John (MSFT)

|||

Hi Guys,

I have found the problem. In other pages, I put command.cancel. Now, I removed all command.cancel. It is ok now.

I use ADO.NET 1.1. I think ADO.NET 1.1 doesn't manage command.cancel well.

Regards,

Troy123