Hi all,
I need to calculate the difference between two dates in a table, but I need the result accurate to a couple of decimal points (example 2.53). I'd like to do something like:
Select DATEDIFF(yy, Date1, Date2) as MyDifference
but of course DATEDIFF() returns an integer, thereby losing...
Please forgive this newbie question...
I'm having trouble seeing just exactly what MSXML 4 (formerly the MS XML Parser) actually is. Is this a separate program that you might independently launch from the Programs menu, or is it actually just sort of plug-in for IE that allows it to interpret...
I am doing a DTS import, and it fails during the process because of bad data in a particular incoming field. But i would like it to show me which incoming row is wrong, so that I can troubleshoot/fix it/whatever. As it is, I'm left guessing as to what data values it thinks it does not like.
I...
If I am in Enterprise Manager, and open a table (say, 'return all rows', for example), there are two Sort icons on the toolbar: A->Z and Z->A.
Why are those icons always grayed out and unaccessible?
Have you ever wanted to show subtotals directly in your query output, and have SQL automatically calculate them for you? It's pretty easy. I was looking at WITH ROLLUP tonight, and these were the results I got.
First, let's see an ordinary query that summarizes on State and Store.
Select...
Earlier in the week there was a discussion about NOT IN and NOT EXISTS. (I believe it was thread183-272715) That discussion reminded me of a problem with NOT IN that many people know about, but might be worth refreshing.
What do you think this will do?
If 'Coconut' NOT IN ('Apple', 'Banana')...
Hi there,
I feel there is a need for a definitive FAQ on how to read Excel spreadsheets from a Select statement. The two basic approaches are with OPENROWSET or with a linked server (which can be created either through script or EM).
If you care to look through thread183-271507 and...
Last week, a suggestion in one of the posts referred to the DBCC SHRINKDATABASE and SHRINKFILE commands. (I believe it was thread183-269676) That got me interested in finding out more about those commands. I learned that there are a couple of little-known options that can be used, and I have...
Does anyone know how, or can provide a clear step-by-step example, of how to set up a linked server so that an ordinary (non-sa) SQL user can read from that spreadsheet via a Select statement.
We've already gotten the Select working with an OPENROWSET function, except it won't work with anyone...
Indexes on Foreign Key Columns
(long but interesting)
Most readers of this forum are well aware that SQL Server does not automatically create any indexes on Foreign Key columns that reference another table. (Although an index is automatically created on a Primary Key column.)
In this small...
I am staring at an Update statement, with CASE conditions on two columns, and I cannot understand why it does not work properly.
(This is actually an expansion of thread183-266358)
We are updating TableA from TableB, as follows:
TableB data looks like:
id type dollars
1 type1 25
1...
I've been doing a bit of testing with @@identity values, found out some stuff I didn't know that you might find interesting.
---------------
@@IDENTITY
---------------
@@identity returns the most recently generated Identity value, from any table, from YOUR connection. Imagine that we have...
<warning alert="This is a loooong question">
I would be interested in comments from readers who are using, or have tried to use, point-in-time recovery. I have not used it in my environment, and am having trouble seeing how it could be made to work in a large, busy database.
i.e...
In thread183-255524 last week, <cfaulkner> correctly comments out GO in the stored procedure like this:
--GO
But you might be interested to discover that this does NOT work with GO:
/*
GO
*/
In this case, the GO will terminate the batch, and will also cause an error, because the parser will...
Hi there,
I feel sure I read about a 3rd-party product that I can use to do this:
I design a html/asp form where user can indicate what fields or columns she wants selected. Browser submits form to IIS server. 3rd-party server plugin is invoked to create an Excel spreadsheet, based on the...
I would like to do some reading on backup/restore (esp restore!) issues on SQL Server. All suggestions for interesting books, FAQs, web links, etc gratefully accepted.
TIA
brian perry
I am writing a stored procedure that will return a record set via ADO.
I want to vary the ORDER BY clause based on a parameter that I will pass in.
ie
If @parm= 1 Select blahblahblah Order by Fld1
If @parm= 2 Select blahblahblah Order by Fld2
If @parm= 3 Select blahblahblah Order by Fld3
Other...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.