Viewing 15 posts - 751 through 765 (of 5,356 total)
So, you're looking for the TOP 2 of each group? Try this:
set nocount on
use northwind
select
t1.CustomerID
, t1.OrderDate
from
orders t1
where
t1.OrderDate in
(
select top 2 --with ties
t2.OrderDate
from
orders t2
...
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
March 23, 2005 at 7:15 am
Can it be that one or more column can contain NULL values?
If so, put an ISNULL around them, since a string + NULL is NULL
And, btw, you're mixing presentational stuff...
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
March 23, 2005 at 7:05 am
Sure thing!
This is an introduction to some of the most interesting undocumented xp's
http://www.sql-server-performance.com/ac_extended_stored_procedures.asp
But keep in mind, that mostly they are undocumented for good reasons. So, evaluate carefully if you...
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
March 23, 2005 at 4:39 am
And if you also want column headers consider this:
http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=5&messageid=169337
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
March 23, 2005 at 4:21 am
Forget to post, I would prefer this:
set nocount on
use tempdb
go
create table class( sno numeric primary key, Names varchar(15),
mark1 int
, mark2 int
, mark3 int
, mark4 int
)
go
insert into class (sno,names,mark1, mark2, mark3,...
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
March 23, 2005 at 3:38 am
Some slight correction, and I got this to work
set nocount on
use tempdb
go
create table class( sno numeric primary key, Names varchar(15),
mark1 int
, mark2 int
, mark3 int
, mark4 int
, total int
)
go
create trigger...
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
March 23, 2005 at 3:31 am
I'm not aware of anything simpler, but this should work:
if object_id('workaround')>0
drop view Workaround
use pubs
go
create view Workaround as
select
au_id
, au_lname
, au_fname
, phone
, address
, city
, state
, zip
, convert(char, contract) 'contract'
, 1 as...
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
March 23, 2005 at 1:40 am
Just to add:
When working with DATETIMES you should use a language and settings independant save format. A pretty good overview can you find here:
http://www.karaszi.com/sqlserver/info_datetime.asp
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
March 23, 2005 at 1:08 am
Why should it continue evaluating when it already found a matching condition?
I think that's one of the basic principles of designing efficient algorithms. Most people tend to place conditions...
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
March 23, 2005 at 1:02 am
A UDF might look something like this:
CREATE FUNCTION dbo.ExtractString(@Input VARCHAR(8000))
RETURNS VARCHAR(10)
AS
BEGIN
DECLARE @pos TINYINT
DECLARE @pos1 TINYINT
SET @pos = CHARINDEX(',',@Input,1)
SET @pos1 = CHARINDEX(',',@Input,@pos+1)
SET @Input = SUBSTRING(@Input,@pos+1, @pos1-@pos-1)
RETURN @Input
END
GO
SELECT dbo.ExtractString('1234,666,12345,12345 ')
DROP FUNCTION dbo.ExtractString
GO
...
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
March 23, 2005 at 12:49 am
When you look at "Maximum capacity specifications" in BOL you'll also find a row telling
| Maximum sizes/numbers | ||
|---|---|---|
| Object | ||
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
March 23, 2005 at 12:30 am
If I have a TEXT of Length 16 it seems to mean 16Bit or 65,536 characters. Is this correct?
Like Antares already said, read BOL.
...and forget the 16 you see in...
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
March 23, 2005 at 12:21 am
Yelena, Date's books are on a very high level, I think. I also think, you can find some of his stuff on http://www.dbdebunk.com
Maybe this will give you an...
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
March 23, 2005 at 12:11 am
I bet you'll find something useful here in the article section. I would look for articles by Brian Kelley. In addition, see if you find http://www.sqlsecurity.com useful in security...
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
March 23, 2005 at 12:03 am
Here's the link to the BOL download page:
It's a free download.
Next, whoever assigned you such a stupid task to keep a redundant column like "total" should sit himself for...
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
March 22, 2005 at 11:57 pm
Viewing 15 posts - 751 through 765 (of 5,356 total)