Viewing 15 posts - 1,876 through 1,890 (of 3,543 total)
Put all the sql in one sql string and EXEC that
or
use a temp table
CREATE TABLE #temp (col1, col2, col3)
INSERT INTO #temp (col1, col2, col3)
SELECT t1.col1, t1.col2, t2.col3 EXEC(@strSQL...
May 18, 2006 at 7:00 am
sp_executesql is not an extended sp it is internal to sql server, extended sp (xp_) are dll's
May 18, 2006 at 6:48 am
![]() | Why did you do an Alias here? |
SQL Server requires sub queries to be aliased, you will get an...
May 17, 2006 at 9:47 am
Depands on a lot of things (and not sure there is a 'most efficient')
Is this a one off?
Single insert or Multiple Inserts?
Via Procedure?
Via Trigger?
One way to derrive the initials is...
May 17, 2006 at 6:56 am
SELECT THREADS.ThreadID, THREADS.ThreadName, USERS.UserName,
[a].DateCreated
FROM USERS INNER JOIN
(([SELECT THREADS.ThreadID, MAX(POSTS.DateCreated) as DateCreated
FROM THREADS INNER JOIN POSTS ON THREADS.ThreadID = POSTS.ThreadID
GROUP BY THREADS.ThreadID]. AS [a]
INNER JOIN...
May 16, 2006 at 11:16 am
May 16, 2006 at 7:17 am
Not sure it will
This might
SELECT t.ThreadID, t.ThreadName, t.ThreadDescription, u.UserName, x.DateEntered
FROM [THREADS] t
INNER JOIN (SELECT t2.ThreadID, MAX(p.DateEntered) AS [DateEntered] FROM [THREADS] t2...
May 16, 2006 at 6:46 am
![]() | There must be dosen clues just in this forum for the last week. |
Yep and even longer than that...
May 16, 2006 at 6:35 am
If single spaced
SELECT LEN(@anystring) - LEN(REPLACE(@anystring,' ','')) + 1
(use LTRIM if required to remove leading spaces)
If the number spaces between the words cannot be guaranteed then use the now famous...
May 15, 2006 at 6:56 am
![]() | I'd be tempted to call it a control loop... |
Well it is
May 15, 2006 at 2:18 am
Yep my first thought as well, still RBAR though
Not sure any faster than CURSOR though
May 12, 2006 at 7:35 am
SELECT MAX(T1),MAX(T2)
FROM (SELECT t1.T1 AS [T1],null AS [T2],(SELECT COUNT(*) FROM @temp1 a WHERE a.T1 <= t1.T1) AS [ID]
FROM @temp1 t1
UNION
SELECT null AS [T1],t2.T2 AS [T2],(SELECT COUNT(*)...
May 12, 2006 at 7:30 am
![]() | QUESTION: How do I return all the records in the QueryTable, together with the associated number of rows... |
May 12, 2006 at 7:20 am
IF OBJECT_ID(@TableName) IS NOT NULL AND OBJECTPROPERTY(OBJECT_ID(@TableName), N'IsUserTable') = 1
PRINT 'Table Exists'
ELSE
PRINT 'Table Does Not Exist'
May 12, 2006 at 6:52 am
There is still a chance that you can get the same checksum value even if the dates were different, although a small chance. If it occurs then you have duplicates...
May 11, 2006 at 7:03 am
Viewing 15 posts - 1,876 through 1,890 (of 3,543 total)