I have this table:
(
,
,)
I tr
Two issues:
Issue #1: don't use TEXT
anymore - it's deprecated. Use a VARCHAR(n)
with a suitable size of n
, or if you really must (only if you REALLY must), use VARCHAR(MAX)
CREATE TABLE dbo.CONNECT_USER
(
NUM_TRF int,
NAME varchar(255),
DESCRIPTION varchar(1000),
REPORT varbinary(max)
)
I would personally also avoid writing EVERYTHING IN ALL CAPS - this just makes it so much harder to read! And I would try to avoid very generic column names like Name
or Description
- those are not very intuitive, and might collide with other table's columns and / or with SQL Server reserved keywords. Try to use more expressive, more context-related column names that make sense in your environment (ConnectUsername
or whatever)
Issue #2: when doing an INSERT
, I would recommend to always define the column you want to insert into. This avoids unpleasant surprises when a table is restructured or new columns are added:
INSERT INTO [MY_DB_APP].[dbo].[CONNECT_USER](NUM_TRF, NAME, DESCRIPTION, REPORT)
VALUES(1, 'name', 'description', CAST('wahid' AS VARBINARY(MAX)))
GO