Viewing 15 posts - 2,761 through 2,775 (of 7,609 total)
The clustered index is the table itself. That is, all columns are stored in the clustered index. Thus, the width is the total width of the entire row.
July 8, 2019 at 6:33 pm
The system itself already has all the metadata views you need. It's best to just use those views: sys.objects, sys.columns, sys.key_constraints, etc..
July 8, 2019 at 4:51 pm
I too would not drop compression to do a load, especially a large one. Page compression can help data load much faster by reducing I/O (compression takes more CPU but...
July 5, 2019 at 7:05 pm
If these are staging tables, just be sure to TRUNCATE the table rather than DELETE the rows. TRUNCATE will keep the table allocations clean without having to create a clustering...
July 5, 2019 at 7:00 pm
I prefer to use CROSS APPLY(s) for such calcs.
Select emp_code, emp_name,emp_last_name, emp_max_pay, emp_yearly_salary
From dbo.table_name
Cross Apply (
Select case when emp_max_pay < 10000 then emp_max_pay...
July 5, 2019 at 6:58 pm
I agree with Jonathan: you've already got the exact index needed to support that query.
What specific version and edition of SQL Server are you on?
In particular, does the specific version...
July 5, 2019 at 4:58 pm
UPDATE dbo.table_name
SET TPN = RIGHT(REPLICATE('0', 8) + CAST(TPN AS varchar(9)), 9)
WHERE TPN NOT LIKE '%[^0-9]%'
July 3, 2019 at 1:19 pm
That codes parses fine for me on SQL 2016.
July 3, 2019 at 1:12 pm
, CAST(p.PeopleID AS varchar(10)) + CASE WHEN p.instructorInt = -1 THEN '-1' ELSE '' END AS OriginalDatabaseId
July 2, 2019 at 8:51 pm
Try this:
select
cast(SystemUser as varchar(25)) as "User",
LogonTime as "Date",
cast(HOST_NAME as varchar(25)) as "Workstation",
SPID as "session",
cast(APP_NAME as varchar(55)) as "Program",
count(SPID) over () AS SystemUserCount /*add this line*/
from ServerLogonHistory
where...
July 2, 2019 at 4:16 pm
Yes, it would also prevent Oracle doing a seek on an index.
If lastUpdatedDate is a date or datetime, just compare it directly to a variable of the matching type, or...
July 2, 2019 at 1:07 pm
It's a waste of space to store dashes: simply char(9) will do. Assuming this is some type of temporary table, otherwise you need to encrypt the data which means you'd...
July 1, 2019 at 7:48 pm
You can do this easily with string functions, but it’s still a stinking kludge caused by bad design. Most of the work in SQL is done in the...
June 28, 2019 at 9:31 pm
;WITH SampleData AS (
SELECT * FROM (VALUES (''),('3#5'),('8063#0018375'),('8063#018375'),
('063#018375'),('063invalid018375')) Data(AccountNumber)
)
SELECT AccountNumber, RIGHT('000000' + SUBSTRING(AccountNumber,
...
June 28, 2019 at 7:20 pm
IF DATEDIFF(DAY, 0, GETDATE()) % 7 <= 4 /*0=Mon;4=Fri;5=Sat*/
AND NOT EXISTS(SELECT 1 FROM dbo.your_holiday_table yht WHERE yht.date = CAST(GETDATE() AS date))
BEGIN
INSERT INTO...
June 28, 2019 at 3:03 pm
Viewing 15 posts - 2,761 through 2,775 (of 7,609 total)