Viewing 15 posts - 2,746 through 2,760 (of 7,609 total)
Agreed. Be nice if MS added the option to the CREATE TABLE statement, so that SQL would "know" that the variable length bytes are not needed at all for the...
July 31, 2019 at 5:06 pm
I created a table with 433 columns: that's where I got the number from. I was hoping that 500 might be possible but the variable-length byte overhead still being required killed...
July 31, 2019 at 3:25 pm
One key thing to note is that you only need to calc the first Sunday date. For future dates, you simply add 7 day intervals to that date. For example:
July 30, 2019 at 5:11 pm
Again, no method will allow you to have more than 433 nvarchar(max) values in one row. Just use separate rows. The entire design needs reworked to make it reasonable and...
July 30, 2019 at 4:56 pm
Use an INSERT trigger to add the hashed column.
SET ANSI_NULLS ON;
SET QUOTED_IDENTIFIER ON;
GO
CREATE TRIGGER employee_table__TR_INS
ON dbo.employee_table
AFTER INSERT
AS
SET NOCOUNT ON;
UPDATE et
SET row_value = HASHBYTES('SHA2_256', first_name + last_name)
FROM dbo.employee_table...
July 30, 2019 at 4:54 pm
Forced-off-row types require only a 16-byte pointer. The 2-byte variable-length overhead per pointer, though, causes even fewer than 500 columns to be possible [I thought SQL would be able to...
July 29, 2019 at 9:09 pm
SELECT
Yr, Pd, Loc,
SUM(Complete) AS Complete,
SUM(Pending) AS Pending,
SUM(Canceled) AS Canceled,
...
July 29, 2019 at 6:42 pm
If using nvarchar(max), in particular, you can simply force the large values off the page into LOB/overflow area.
After creating the table, but before loading it, run the following command:
EXEC sys.sp_tableoption...
July 29, 2019 at 6:39 pm
Like so:
SELECT EmpName,
MAX(CASE WHEN row_num = 1 THEN Item END) AS item1,
MAX(CASE WHEN row_num = 2 THEN Item END)...
July 26, 2019 at 3:20 pm
If I need to know the location, I usually set a variable with a location id that is unique.
DECLARE @code_location varchar(20)
SET @code_location = '1000-SELECT'
BEGIN TRY
...
END TRY
BEGIN CATCH
SELECT...
July 25, 2019 at 5:28 pm
Just create a separate drive path for backups on that machine and, to keep it simple, make sure there are no spaces or other unexpected chars in the path name.
Btw,...
July 24, 2019 at 5:17 pm
For an OUTER JOIN, you must put conditions on the possibly-missing table in the JOIN clause, not in the WHERE clause.
select * from #temp1 T
left join #temp2...
July 23, 2019 at 2:54 pm
I don't know about the overall logic, but the JOINs above seem needlessly convoluted. Instead, maybe:
INNER JOIN #UserB AS B
ON ...
July 22, 2019 at 6:53 pm
I think the Milestone table does not contain a column named "TOT_ABSENCES". Please review the column names in the Milestone table.
July 15, 2019 at 5:14 pm
Create an index keyed on pbRecordId on that table.
July 12, 2019 at 8:55 pm
Viewing 15 posts - 2,746 through 2,760 (of 7,609 total)