Viewing 15 posts - 5,761 through 5,775 (of 7,597 total)
GilaMonster (9/22/2014)
September 22, 2014 at 10:24 am
IF OBJECT_ID('tempdb.dbo.#sp_spaceused') IS NOT NULL
DROP TABLE #sp_spaceused
CREATE TABLE #sp_spaceused (
db_name varchar(100) NOT NULL CONSTRAINT sp_spaceused__DF_db_name DEFAULT '',
name varchar(100)...
September 22, 2014 at 10:22 am
You did add 70 rows, so while the growth is a little higher than average, it's not ridiculously high. Yes, you do want to convert to varbinary(max) instead of...
September 19, 2014 at 12:18 pm
That "DISTINCT" is a big concern. Either the joins are producing dups, and thus the joins need modified, or the code is needlessly forcing SQL to sort the results.
September 19, 2014 at 9:41 am
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
Viewing 15 posts - 5,761 through 5,775 (of 7,597 total)