Viewing 15 posts - 286 through 300 (of 902 total)
You're looking at using a LEFT OUTER JOIN read up on themhere http://msdn.microsoft.com/en-gb/library/ms187518(v=sql.105).aspx
_________________________________________________________________________
SSC Guide to Posting and Best Practices
March 8, 2013 at 7:32 am
I would suspect that there's some sort of internal algorithm used to select the best sort algorithm for a given data set, based on the data type, data volumes etc
_________________________________________________________________________
SSC Guide to Posting and Best Practices
March 8, 2013 at 5:13 am
You are missing the quotes round the value on the name = CFGMGR.
select *
from sys.databases
where name = 'CFGMGR'
_________________________________________________________________________
SSC Guide to Posting and Best Practices
March 7, 2013 at 9:27 am
Thanks for the feedback, I was glad to help.
_________________________________________________________________________
SSC Guide to Posting and Best Practices
March 7, 2013 at 9:24 am
This should work especially if you're not bothered about the order of the insert for Table 1
INSERT INTO @test1(C_NAME, C_CODE)
(SELECT P_NAME,
C_CODE = 'CL' + CONVERT(VARCHAR(5),@x+ROW_NUMBER() OVER (ORDER BY...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
March 7, 2013 at 8:20 am
Sorry my misunderstanding about the columns.
_________________________________________________________________________
SSC Guide to Posting and Best Practices
March 7, 2013 at 8:13 am
No problem, Its what ever is best for your environment and organisation.
The problem with the table is that you stated it was for a dynamic, number of columns so...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
March 7, 2013 at 7:17 am
When you build the column list you could build them with an alias in using a ROW_NUMBER() over (ORDER BY).
Create Table #TDP_AP
(
periodo varchar(10)
)
Insert into #TDP_AP
Values('201201')
,('201202')
,('201203')
DECLARE @columnsVEN_AP_REP_Alias varchar(max)
SET @columnsVEN_AP_REP_Alias
=...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
March 7, 2013 at 6:55 am
The problem is that you are using
Select
Table1.*
,Table2.*
From
Table1
...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
March 7, 2013 at 4:51 am
You might actually benefit from setting up a calendar table with a Column indicating the Start of the week, and once set up it should also enable you to quickly...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
March 5, 2013 at 2:37 am
I'm not sure what you are trying to do here.
The problem that you have is that on the first two rows you indicate for a required data set, the data...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
March 5, 2013 at 12:50 am
As everyone else has said they wouldn't have hired you if they didn't think you were up to the job.
as it is if they have as many servers as you...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
March 4, 2013 at 7:15 am
At the moment you have it written like an IF Statement
CASE
WHEN conditional_a = conditional_b THEN something
ELSE conditional_a = conditional_c THEN something_else
...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
March 4, 2013 at 2:52 am
This is called a cross Tab.
The simplest method is
SELECT
CourseId
,SUM(CASE WHEN ScheduleTerms = 'Q1' THEN 1 ELSE NULL END) [Q1]
...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
March 1, 2013 at 9:31 am
If you go to this link http://www.sqlservercentral.com/articles/71564/ there's a link to a free book about how the query optimizer works, its not a deep dive, but goes into the basics...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
February 27, 2013 at 2:44 am
Viewing 15 posts - 286 through 300 (of 902 total)