Viewing 15 posts - 5,776 through 5,790 (of 7,608 total)
Does the view use "SELECT *" and/or some other generic column name, such as $ROWGUID? [If you posted the view definition, sorry, I didn't see it.]
You could also create the...
September 19, 2014 at 9:24 am
Luis Cazares (9/18/2014)
I support your code if it's accompanied by the proper comments describing what it does. I'm not trying to be pedantic, this...
September 18, 2014 at 4:40 pm
SELECT
COUNT(C.[Place Referance]) AS [April Total Voids],
SUM(CASE WHEN [Void End Date] IS NULL THEN 1 ELSE 0 END) AS [April_Still_Voids]
...
September 18, 2014 at 4:32 pm
You should use a computed column if possible. If not, you can still take the conversion code from below and use it in an UPDATE:
ALTER TABLE [HR_DEV_DM].[CFQ_TEST].sp_CFQ_Commercial_Referrals
ADD CreatedBy_SalesRepSharePointID AS...
September 18, 2014 at 4:24 pm
I recommend avoiding unnecessary string conversions/usage, and dependencies on language and/or other SQL settings.
Not sure what the h "N" means, but I still suggest this style of code instead:
WHERE DATEDIFF(DAY,...
September 18, 2014 at 4:20 pm
Jeff Moden (9/18/2014)
ScottPletcher (9/18/2014)
September 18, 2014 at 4:15 pm
CPU is typically not the bottleneck nowadays, I/O is. More RAM = bigger buffers = less I/O. Thus, RAM will typically be much more vital to performance that...
September 18, 2014 at 1:52 pm
Or:
SELECT OBJECTPROPERTYEX ( OBJECT_ID('object_name') , 'IsView' ) AS IsViewOrNot
September 18, 2014 at 1:39 pm
I believe my code above met your (implied) challenge ;-).
September 18, 2014 at 10:13 am
Use a trigger on InvLoc to keep the total in PStat up to date. No one should be updating the total in PStat directly if they need to be...
September 17, 2014 at 1:01 pm
Try this:
declare @t table (Qty decimal(12,3),CF1 Decimal(12,3),CF2 Decimal(12,3),Flag TinyInt)
set nocount on
insert @t select 10,2,6,0
insert @t select 10,2,6,1
insert @t select 40,2,8,1
insert @t select 40,2,8,0
set nocount off
SELECT
Qty, Flag, CF2 / CF1 AS...
September 17, 2014 at 10:58 am
I'd change the collation first, since I think that will affect the compression. I believe the overall compression overhead, including I/O, would outweigh any advantages gained in I/O.
September 17, 2014 at 10:13 am
But those conditions within the WHERE clause could convolute the query plan and thus the performance.
Much better to set variables and have a simple and consistent WHERE clause, allowing SQL...
September 16, 2014 at 9:59 pm
DECLARE @start_date datetime
DECLARE @end_date datetime
IF @parameter = 'GT30'
BEGIN
SET @start_date = '19000101'
SET @end_date = GETDATE() - 30
END --IF
ELSE
IF @parameter = 'LT30'
BEGIN
...
September 16, 2014 at 5:13 pm
I'm virtually certain you'll get an error if the linked server isn't there.
You could use dynamic SQL, which will only be compiled if/when it's run.
As to recompiles, SQL will not...
September 16, 2014 at 4:49 pm
Viewing 15 posts - 5,776 through 5,790 (of 7,608 total)