Viewing 15 posts - 1,876 through 1,890 (of 3,544 total)
What datatype is YYYYMM and what format/datatype is 'current month'
Assuming, like Pam, that YYYYMM is char and 'current month' is the same format/type as YYYYMM then
DECLARE @start char(6)
SET @start =...
Far away is close at hand in the images of elsewhere.
Anon.
May 18, 2006 at 7:17 am
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...
Far away is close at hand in the images of elsewhere.
Anon.
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
Far away is close at hand in the images of elsewhere.
Anon.
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...
Far away is close at hand in the images of elsewhere.
Anon.
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...
Far away is close at hand in the images of elsewhere.
Anon.
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...
Far away is close at hand in the images of elsewhere.
Anon.
May 16, 2006 at 11:16 am
Deja Vu ![]()
http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=8&messageid=235707
Far away is close at hand in the images of elsewhere.
Anon.
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...
Far away is close at hand in the images of elsewhere.
Anon.
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...
Far away is close at hand in the images of elsewhere.
Anon.
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...
Far away is close at hand in the images of elsewhere.
Anon.
May 15, 2006 at 6:56 am
| I'd be tempted to call it a control loop... |
Well it is ![]()
Far away is close at hand in the images of elsewhere.
Anon.
May 15, 2006 at 2:18 am
Yep my first thought as well, still RBAR though ![]()
Not sure any faster than CURSOR though ![]()
Far away is close at hand in the images of elsewhere.
Anon.
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(*)...
Far away is close at hand in the images of elsewhere.
Anon.
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... |
Far away is close at hand in the images of elsewhere.
Anon.
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'
Far away is close at hand in the images of elsewhere.
Anon.
May 12, 2006 at 6:52 am
Viewing 15 posts - 1,876 through 1,890 (of 3,544 total)