Viewing 15 posts - 6,586 through 6,600 (of 8,731 total)
Lynn Pettis (4/7/2014)
April 7, 2014 at 12:10 pm
Sean is right, you're overcomplicating things. You can use INSERT INTO...SELECT instead of values.
INSERT INTO dbo.HemTransfer (
TraTrtId
,TraAniId
,TraDate
)
SELECT 2
,ha.AniId
,ha.AniBirthday
FROM HemAnimal ha --This is a guess
WHERE ha.AniUserNumber = 123456
April 7, 2014 at 11:20 am
You might be overcomplicating yourself. Grouping by page will give you one row per page value. Using COUNT(DISTINCT column) will count for each unique value.
You'll end up with a code...
April 7, 2014 at 10:18 am
Sean Lange (4/7/2014)
Ed Wagner (4/7/2014)
Sean Lange (4/7/2014)
Greg Edwards-268690 (4/7/2014)
Is the grass green?
I still see white and brown around here. 🙂
Sad about the refs - kids need to learn...
April 7, 2014 at 9:38 am
I was expecting to use an explicit transaction that will roll back at the end of the code within a try...catch block. This might not be the best option all...
April 7, 2014 at 8:33 am
djj (4/7/2014)
Why would you want to scan the table four times when you can do it just once?
Because I forget about CROSSAPPLY as I have not used it as often...
April 7, 2014 at 8:19 am
djj (4/7/2014)
This will do the same thing:
Why would you want to scan the table four times when you can do it just once?
CREATE TABLE #Test( customnr int, number int, wk...
April 7, 2014 at 8:12 am
How do you differentiate customnr & number from wk1, wk2, wk3, etc.?
April 7, 2014 at 7:43 am
This might work for you. You should study about recursive CTEs to understand what it is doing.
If you have questions, please ask them.
WITH rCTE AS(
SELECT Id
,[NewId]
,1 AS n
FROM #Temp1
UNION...
April 7, 2014 at 7:33 am
Can you post your variables declaration?
You might have a truncation problem. Check the following code that looks the same but has an important difference.
DECLARE @ExtType varchar(10) = 'X',
@PhoneNo varchar(20) =...
April 4, 2014 at 4:03 pm
Sarah Wagner (4/4/2014)
Try this...SELECTpd.year,
pd.period,
pd.startdate,
df.projectnumber,
df.startdate_contract,
df.enddate_contract,
MONTH(df.startdate_contract) AS month
FROMperdat pd (NOLOCK)
LEFT OUTER JOIN ProjectDateFields df (NOLOCK) ON df.startdate_contract BETWEEN pd.startdate AND pd.enddate
and df.projectnumber = 'CR1003753'
Or try it without the NOLOCK hints which will...
April 4, 2014 at 9:26 am
What's your problem? You just need to remove the CTE and replace it with your table. You've mentioned that on the comments, so I can't see the problem.
April 3, 2014 at 6:11 pm
That's a horrible way to do it. You're reading the table 4 times instead of one.
I gave you an example and an article that fully explains that method.
April 3, 2014 at 5:37 pm
Check the following article on Cross Tabs: http://www.sqlservercentral.com/articles/T-SQL/63681/
WITH SampleData (PERSON, [DATA], [FIELD]) AS
(
SELECT 1234,'04/02/2014','Date'
UNION ALL SELECT 1234,'123','Department'
UNION ALL...
April 3, 2014 at 5:27 pm
You need to cast Interval to a varchar value.
April 3, 2014 at 5:16 pm
Viewing 15 posts - 6,586 through 6,600 (of 8,731 total)