Skip to content

Commit 35948df

Browse files
authored
added sql colorizer
1 parent 3bc0385 commit 35948df

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

docs/t-sql/functions/text-and-image-functions-textptr-transact-sql.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ ms.author: jrasnick
3434

3535
## Syntax
3636

37-
```
38-
37+
```syntaxsql
3938
TEXTPTR ( column )
4039
```
4140

@@ -72,10 +71,10 @@ TEXTPTR ( column )
7271
### A. Using TEXTPTR
7372
The following example uses the `TEXTPTR` function to locate the **image** column `logo` associated with `New Moon Books` in the `pub_info` table of the `pubs` database. The text pointer is put into a local variable `@ptrval.`
7473

75-
```
74+
```sql
7675
USE pubs;
7776
GO
78-
DECLARE @ptrval varbinary(16);
77+
DECLARE @ptrval VARBINARY(16);
7978
SELECT @ptrval = TEXTPTR(logo)
8079
FROM pub_info pr, publishers p
8180
WHERE p.pub_id = pr.pub_id
@@ -86,8 +85,8 @@ GO
8685
### B. Using TEXTPTR with in-row text
8786
In [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)], the in-row text pointer must be used inside a transaction, as shown in the following example.
8887

89-
```
90-
CREATE TABLE t1 (c1 int, c2 text);
88+
```sql
89+
CREATE TABLE t1 (c1 INT, c2 TEXT);
9190
EXEC sp_tableoption 't1', 'text in row', 'on';
9291
INSERT t1 VALUES ('1', 'This is text.');
9392
GO
@@ -103,7 +102,7 @@ COMMIT;
103102
### C. Returning text data
104103
The following example selects the `pub_id` column and the 16-byte text pointer of the `pr_info` column from the `pub_info` table.
105104

106-
```
105+
```sql
107106
USE pubs;
108107
GO
109108
SELECT pub_id, TEXTPTR(pr_info)
@@ -131,7 +130,7 @@ pub_id
131130

132131
The following example shows how to return the first `8000` bytes of text without using TEXTPTR.
133132

134-
```
133+
```sql
135134
USE pubs;
136135
GO
137136
SET TEXTSIZE 8000;
@@ -162,10 +161,10 @@ This is sample text data for Lucerne Publishing, publisher 9999 in the pubs data
162161
### D. Returning specific text data
163162
The following example locates the `text` column (`pr_info`) associated with `pub_id``0736` in the `pub_info` table of the `pubs` database. It first declares the local variable `@val`. The text pointer (a long binary string) is then put into `@val` and supplied as a parameter to the `READTEXT` statement. This returns 10 bytes starting at the fifth byte (offset of 4).
164163

165-
```
164+
```sql
166165
USE pubs;
167166
GO
168-
DECLARE @val varbinary(16);
167+
DECLARE @val VARBINARY(16);
169168
SELECT @val = TEXTPTR(pr_info)
170169
FROM pub_info
171170
WHERE pub_id = '0736';

0 commit comments

Comments
 (0)