Viewing 15 posts - 1 through 15 (of 110 total)
Put a * or name some columns after the last select.
For example,
select * -- a.column_name or a.is_nullable etc
from #a a
left join #b b -- left/right/full...
September 8, 2010 at 3:36 pm
The first example does not leave a trailing comma.
For the second example, this should do:
declare @email varchar(1000)
set @email = ''
select @email = @email + email + ','
from #Friends_List
where email is...
February 26, 2010 at 9:31 pm
There are several posts on this site that address this sort of thing. Here are 2 ways.
-- drop table #Friends_List
GO
create table #Friends_List (row int identity(1,1), email varchar(100))
GO
insert into #Friends_List select...
February 12, 2010 at 8:56 pm
You want the General option, not the Results to Grid one.
Tools > Options > Query Results > Sql Server > General > drop down "Default destination for results" > button...
February 12, 2010 at 8:23 pm
Here's one method. Note the command is undocumented. Look around this site if you need more info on it. The NORESEED option is shown here to prevent someone from doing...
July 15, 2009 at 5:46 pm
You could use the ignore_dup_key option with a unique index and get a similar effect.
create unique index ix_Uniq on MyTable (colA asc) with ignore_dup_key
create table MyTable (colA int not null,...
July 14, 2009 at 9:25 pm
Yes, making a relationship similar to the one you mention is a good way to go. It's certainly a better way than adding columns in your name table. You have...
July 14, 2009 at 9:13 pm
I agree with GSquared that the kind of questions to ask have to fit the sort of things you are going to ask the people to do.
I'd be more interested...
July 9, 2009 at 7:51 pm
In Sql 2005 you can use the OUTPUT clause to write the new identities into another table. Here is a simple example. See BOL for better ones.
create table #hdr (a...
July 8, 2009 at 8:48 pm
In Sql 2005 you can use the OUTPUT clause to write the new identities into another table. Here is a simple example. See BOL for better ones.
create table #hdr (a...
July 8, 2009 at 8:47 pm
The first code you posted does work according to your requirements. From the sample data you posted there are no records in T1 that can be deleted. All of the...
July 1, 2009 at 8:48 pm
You did. Parentheses can make a difference.
select datediff(n, '2009-06-30 20:37:16', '2009-06-30 20:49:00') / (datediff(n, '2009-06-30 05:00:00', '2009-06-30 10:00:00') * 1.0)
should get you 0.0400
An alternative is to explicitly convert one or...
June 30, 2009 at 7:46 pm
Try it without the square brackets around the server name\instance.
Also, -U -P and -T options are redundant. Use either -U with -P or -T by itself (although you can use...
June 30, 2009 at 7:32 pm
See BOL's topic "SQL Server Batch or Task Scheduling".
The vendor's way made 47,000+ batches in one execution plan. That may have exhausted all of the available worker threads.
Your method used...
April 30, 2009 at 10:07 pm
see http://www.sqlservercentral.com/Forums/Topic527870-146-1.aspx, specifically Todd Engen's note.
-- to remove mail more than a week old, this will do:
DECLARE @SentBefore datetime
SET @SentBefore = DateAdd(day, -7, DateAdd(day, DateDiff(day, 0, getdate()),...
February 17, 2009 at 8:06 pm
Viewing 15 posts - 1 through 15 (of 110 total)