Viewing 15 posts - 1 through 15 (of 89 total)
IF only determines if the statement is going to execute. Or the next batch of statements in a BEGIN END section. So in your code,
IF (@Status =...
January 22, 2008 at 12:18 pm
SELECT INTO expects to create the destination table. If you are trying to load them into an existing table, you need to do INSERT INTO Table (list of destination...
January 22, 2008 at 10:46 am
IF (@Status = 'All Active')
SET @SQLStr = 'SELECT * FROM #DLFiltered WHERE Active = 1 '
SET @SQLStr = @SQLStr + ' AND CurrentLevelXID BETWEEN ' + CONVERT(Varchar(2),@AchieveLevelStart ) + '...
January 22, 2008 at 10:41 am
Or, you can highlight the cells you want to change, right click and choose format. Select the Custom Category. Then in the Type: field, type in a zero...
October 4, 2007 at 12:30 pm
I didn't see this in any of the posts, but will throw it out there anyway. If you do a convert to varchar, without specifying a length, it defaults...
October 4, 2007 at 11:01 am
Start by looking up "INSERT" in BOL.
September 24, 2007 at 7:39 am
You should be able to add an Execute SQL Statement step into your DTS. Then use XP_SendMail in the SQL statement.
Brian
August 1, 2007 at 9:28 am
And why does this work?
select id, name
from sysobjects so
order by abcd.id
It appears to ignore the alias if it doesn't exist.
Brian
July 20, 2007 at 8:30 am
Assuming the concatenated string of attributes will be less than 8000 characters, you don't need to do the cursor. Your function could look something like the following.
CREATE FUNCTION dbo.AllAttributes
(@Order INT)
RETURNS...
July 19, 2007 at 3:27 pm
I thought I read somewhere once that if you alter the datatype of a column, SQL basically abandons the location of the old column and moves the data to the...
July 16, 2007 at 1:55 pm
Because sometimes the simple answers are the hardest to see.
Brian
July 16, 2007 at 12:41 pm
On my system, both of your options cause a clustered index scan. Ideally you want an index seek. This is accomplished by my first suggestion. Based on your table definition...
July 16, 2007 at 12:38 pm
Then how about
SELECT ....
WHERE CASE WHEN @RecordId IS NULL THEN RecordGuid ELSE RecordId END=CASE WHEN @RecordId IS NULL THEN @RecordGuid ELSE @RecordId END
AND CASE WHEN @RecordGuid IS NULL THEN RecordId ELSE...
July 16, 2007 at 10:44 am
I would have two queries.
If @RecordId IS NULL
... WHERE RecordGuid=@RecordGuid
ELSE
... WHERE RecordId=@RecordId
Of course, this assume that exactly one will always be provided.
Brian
July 16, 2007 at 10:09 am
--Create a tally table of sequential numbers
SELECT TOP 1000000
N=IDENTITY(INT,1,1)
INTO Tally
FROM Master.dbo.SysObjects sc1,
Master.dbo.SysObjects sc2
--Make sure it is indexed
ALTER TABLE Tally ADD PRIMARY KEY CLUSTERED (N)
--Create my test data
CREATE TABLE #test...
July 16, 2007 at 10:06 am
Viewing 15 posts - 1 through 15 (of 89 total)