|
Pls. tell me about good and interesting book to clear the concept of Sql,Dynamic Procedures and User defined Functions with good examples.
|
|
|
|
|
I do not read technical books anymore because information is much easier to find online now. I know some people still read books and it does have its place but I would suggest you google for some examples.
Often when I google how to do something in sql this blog is in the result set. http://blog.sqlauthority.com/[^] It is very well written. I highly recommend going through it.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I have table looks like below.
EMPID QID QDesc Reason Sub Reason Remarks
201 1 Question 1 Reason1 Break Taking break
201 2 Question 2 Reason2 Poor
201 2 Question 2 Reason3 Good
201 2 Question 2 Reason4 Average
201 2 Question 2 Reason5 Good
201 2 Question 2 Reason6 Average
201 2 Question 2 Reason7 Average
201 2 Question 2 Reason8 Average
201 3 Question 3 NA
201 4 Question 4 Reason9
201 5 Question 5 Reason10 Yes
Required Output from the above table should be in the below format. Please help.
Emp ID Question 1 Question 2 Question 3 Question 4 Question 5 Remarks
Reason Sub reason Remarks Reason2 Reason3 to Reason8
modified 15-Oct-14 2:25am.
|
|
|
|
|
This article [^]might help you!
You are looking at a PIVOT table.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
So I have 3 Tables
OrderInfo - Unique records
ShipRates - Unique records
OrderInfo_Emails - A list of non-unique records
There are 3 records in orderinfo, but I get 4 results back, because orderinfo_email has 2 records with the same orderinfo id. So I get that, why I get 4 back and not 3
Should I just drop the OrderInfo_Email Join and do something else, some other way, or is there a way to limit the results from the join?
SELECT
oi.OrderInfoID
, oi.OrderDate
, oi.OrderNum
, oi.LoginID
, oi.OrderStatus
, oi.AuthorizationID
, oi.ApprovalCode
, oi.Shipping
, oi.PaymentInfo
, oi.SubTotal
, oi.GrandTotal
, oi.RateAPICode
, oi.TotalNetCharge
, srr.RateName
, oie.MessageID
, oie.DateSent
, oie.SentBy
FROM OrderInfo oi
LEFT JOIN ORDERINFO_EMAIL oie
ON (oie.OrderID = oi.OrderInfoID )
LEFT JOIN Shipping_RealTime_Rates srr
ON (srr.RateAPICode = oi.RateAPICode)
ORDER BY oi.OrderDate DESC
|
|
|
|
|
How do you pick the one you want? What the criteria?
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Oh, the first one is fine,
It's for Abandoned Orders, in which a email is sent to the customer as a reminder. You can send multiple emails to the customer, in which the emails are logged in ORDERINFO_EMAIL, So When you load the Abandoned Orders, if a email record record exist, a little envelope icon appears.
|
|
|
|
|
You may try this:
SELECT
oi.OrderInfoID
, oi.OrderDate
, oi.OrderNum
, oi.LoginID
, oi.OrderStatus
, oi.AuthorizationID
, oi.ApprovalCode
, oi.Shipping
, oi.PaymentInfo
, oi.SubTotal
, oi.GrandTotal
, oi.RateAPICode
, oi.TotalNetCharge
, srr.RateName
, (select count(*) from ORDERINFO_EMAIL oie where oie.OrderID = oi.OrderInfoID) AS email_sent
FROM OrderInfo oi
LEFT JOIN Shipping_RealTime_Rates srr
ON (srr.RateAPICode = oi.RateAPICode)
ORDER BY oi.OrderDate DESC
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
I was thinking the same thing to keep it simple
OK, I'm going with that idea.
Thanks!
|
|
|
|
|
When and why this kind of exception occurs ?
If it occurs then why the SQL Server dont show the column name to which this exception belongs ?
|
|
|
|
|
Vijay G. Yadav wrote: why the SQL Server dont show the column name to which this exception belongs
Because SQL server is a PITA with this error. I have yet to find a simple way to debug this error, rabbiting through all the text fields and checking the length is just irritating.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
Vijay G. Yadav wrote: why the SQL Server dont show the column name to which this exception belongs ?
Good question. There's a suggestion to fix this on Connect[^], which has been open since 2008. So far, Microsoft have not responded.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
|
A log file has been growing very fast from 2 gig up to 19 gig in a matter of about 4 hours.
The recovery model is set as full.
Even with backing up the transaction log file, every 30 minutes, I have found that the log file is not getting truncated.
I did notice that the file growth stopped as soon as the workday came to a close.
On running DBCC SQLPERF(LOGSPACE) I noticed that the log space was being eaten up fairly quickly. Also on running DBCC OPENTRAN I did not see any really old transactions that had not been commited
In my investigations someone mentioned that if a person was selecting a large volume of data this could make the log file grow. It is quite possible to select in the region of 9million plus rows in a select query of this database.
I was under the impression that the transaction log file only contained updates, deletes and inserts in order to be able to rebuild the database at any point in time. Having googled this I am not any the wiser.
I will run some more diagnostic tests on Monday to see if I can discover any more information if I see the log file growing rapidly again.
So my question is – would a large number of individual select commands, or a high volume of data being selected get logged to the transaction log file?
_____________________________________________
Solved - read below
_____________________________________________
It turns out that a user was running a large report which kept falling over.
They kept restarting the report.
The software is a 3rd party piece of software that appears to write results to some sort of temporary table.
I asked the user to run the report first thing this morning, when the office was very quiet.
Using DBCC SQLPERF(LOGSPACE) I then noticed the log starting to be eaten up again and when the report completed the log stopped growing.
So I think I am going to set up some sort of warning system that monitors log growth over time and alerts me when it starts ballooning as it did on Friday.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
modified 6-Oct-14 8:04am.
|
|
|
|
|
Have a look at the log_reuse_wait_desc column in sys.databases - that should give you some idea of what's preventing the log from being truncated.
SELECT
[name],
recovery_model_desc,
log_reuse_wait_desc
FROM
sys.databases
;
Technet has a description of the values:
http://technet.microsoft.com/en-us/library/ms345414%28v=sql.105%29.aspx[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks - yes I was looking at this on Friday.
I discovered it was a user who was running a report that kept falling over and they kept restarting it.
The software is a 3rd party piece of software and it looks like when users select data the results are written to some sort of temporary table within the database.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
hi... is there a max limit to throughput of Microsoft SQL Server cluster in terms of how many request (or... *simple* query) the cluster can take per minute?
What about a single SQL server instance, assuming you can scale up throwing in $$$ put more RAM/CPU/faster disks...etc
Thanks
dev
|
|
|
|
|
|
Yes you can get better server performance o a single server by money at it, not your best question.
There is an entire industry based around server performance, not going to be answered by a forum post.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
No, there's no hard limit defined. Yes, there will be a practical limit.
devvvy wrote: What about a single SQL server instance, assuming you can scale up throwing in If you can throw in money, hire a dba.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
devvvy wrote: hi... is there a max limit to throughput of Microsoft SQL Server cluster in terms of how many request (or... *simple* query) the cluster can take per minute?
Everything in computing has limits but I doubt that has anything to do with your question.
Presumably you or someone else you know thinks that X is 'better' than SQL server without even doing any real analysis.
Here is an example of someone using SQL Server
http://highscalability.com/blog/2014/7/21/stackoverflow-update-560m-pageviews-a-month-25-servers-and-i.html[^]
Myself I was tasked with doing performance tests using the application that I was working on, and at the time the application server could handle 100+ TPS a second sustained where I estimated that the entire US market for that business domain was only 2000 TPS.
And during that test I couldn't get SQL Server to even provide any real CPU/Memory load on some pretty crappy equipment. Consequently my conclusion was that for any conceivable reality a single SQL server instance would serve the needs of the company.
Now it is certainly possible that you have a business domain that has some very specific data needs based on the business needs. Not hypothetical tech arguments. If so then you need to do the following
- Collect the actual business requirements that might lead to performance problems.
- Collect the actual market potential of business. One might reasonably claim as a top level that owning the entire market in the world is the goal but claiming astronomical numbers without any real world basis is foolhardy. So is making up numbers without looking at markets at all.
- Do an analysis of likely transaction flows based on the first item.
- Identify possible bottle necks.
- AFTER doing the above then look for solutions that will solve any bottle necks at the data persistence layer.
Finally expect that if you have bottle necks at the data persistence layer then you MUST expect that you are going to need to have other architectural changes necessary to deal with that. A specific type of data persistence server will NOT solve problems of this sort.
|
|
|
|
|
Make that the visible universe.
|
|
|
|
|
thanks I just saw a tweet yesterday claiming MongoDB can take few million hits over few minutes duration. I just want to know if, for example, on an average machine or even workstation, what kind of hits Microsoft SQL server can process?
dev
|
|
|
|