SELECT *, DATALENGTH(Report) as Report_Length FROM dbo.rep_crit
SELECT
*, DATALENGTH(Report)
as
Report_Length
FROM
dbo.rep_crit
UPDATE dbo.rep_crit SET report = LEFT(RTRIM(report) + SPACE(20),20)
UPDATE
SET
report =
LEFT
(RTRIM(report) +
SPACE
(20),20)
;WITH
cte
AS
(
c.is_nullable
,c.object_id
table_id
,OBJECT_NAME(c.object_id)
TableName
,c.max_length
,c.
NAME
column_name
,
CASE
c.is_ansi_padded
WHEN
1
THEN
'On'
ELSE
'Off'
END
[ANSI_PADDING]
,T.
ColType
sys.columns c
INNER
JOIN
sys.types T
ON
c.system_type_id = T.system_type_id
WHERE
T.
IN
'varbinary'
'varchar'
)
'ALTER TABLE dbo.'
+ quotename(cte.TableName) +
' ALTER COLUMN '
+ QUOTENAME(cte.column_name) +
' '
+ cte.ColType +
'('
+
cte.max_length = - 1
'max'
CAST
(cte.max_length
VARCHAR
(30))
')'
cte.is_nullable = 1
' NULL '
' NOT NULL'
objname
fn_listextendedproperty(
'SIRIUS_DefaultTable'
'user'
'dbo'
'table'
NULL
) st
st.objname = cte.TableName
AND
cte.ANSI_PADDING =
Naomi N edited Revision 27. Comment: Added See Also
Ed Price - MSFT edited Revision 24. Comment: tags
Ed Price - MSFT edited Revision 25. Comment: ruined code
Richard Mueller edited Revision 20. Comment: Minor edits
Naomi N edited Revision 19. Comment: Added other languages section
Naomi N edited Revision 18. Comment: Link fix
Naomi N edited Revision 17. Comment: Removed 'my'
Naomi N edited Revision 16. Comment: More formatting
Naomi N edited Revision 15. Comment: Formatting
Naomi N edited Revision 14. Comment: Added headings and toc
Naomi N edited Revision 1. Comment: Adjusted code block
Naomi N edited Revision 2. Comment: Added "has image" tag
Naomi N edited Revision 4. Comment: Typos fixes mostly
Ed Price - MSFT edited Revision 6. Comment: Title casing. Great article!
Ed Price - MSFT edited Revision 7. Comment: Spacing before images.
Hi Noami,
there is also an interesting thing to me which come across today with ANSI_PADDING. Please find the below forum thread.
social.msdn.microsoft.com/.../07d66ebb-4f39-4e61-a207-ee77d71b34ad
Thanks!
Naomi N edited Revision 8. Comment: Added another case from the comments
Naomi N edited Revision 10. Comment: Minor
Naomi N edited Revision 13. Comment: Minor edit
Naomi, could you use headers and a TOC to break up the sections of the articles? These are amazing articles, and that would make them easier to read/parse. Thanks!