SQL Server T-SQL
As follows:
Table Structure:
Field name ID title content
Int char (200) Text
Insert into news (title, content) values (@ title, @ content)
In fact, the content field cannot exceed 8000 bytes ). Sqlserver imposes restrictions on this.
You can insert
Create Procedure Newsinsert @ Title Char ( 200 ), @ Content Text As
Insert Into News (title, content) Values ( @ Title , '' )
Declare @ Ptrval Binary ( 16 )
Select @ Ptrval = Textptr (Content)
From News
Where ID = @ Identity
Writetext News. Content @ Ptrval @ Content
Go
UsedWritetext function.
Note: when insertingInsert IntoNews (title, content)Values(@ Title,''Must have a blank content value. content cannot be set to null. Otherwise, the following cannot be found.
When updating: Create Procedure Newsinsert @ Title Char ( 200 ), @ Content Text , @ ID Int As
Update News Set Title = @ Title , Content = '' Where ID = @ ID -- Note that content = ''does not work, but it is best to write it to avoid null content.
Declare @ Ptrval Binary ( 16 )
Select @ Ptrval = Textptr (Content)
From News
Where ID = @ ID
Writetext News. Content @ Ptrval @ Content
Go
When reading and deleting data, everything is normal.
The above usage can be inserted within the actual theoretical length corresponding to the database type text.