Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

cdn.s3techtraining.com
from cdn.s3techtraining.com More from this publisher
17.06.2013 Views

Appendix A: System Functions Text and Image Functions The text and image functions perform operations on text or image data. They are: ❑ PATINDEX (This was covered in the “String Functions” section earlier in the appendix.) ❑ TEXTPTR ❑ TEXTVALID TEXTPTR The TEXTPTR function checks the value of the text pointer that corresponds to a text, ntext, or image column and returns a varbinary value. The text pointer should be checked to ensure that it points to the first text page before running READTEXT, WRITETEXT, and UPDATE statements. The syntax is as follows: TEXTPTR() TEXTVALID 648 The TEXTVALID function checks whether a specified text pointer is valid. The syntax is as follows: TEXTVALID(‘’, ) The table.column parameter specifies the name of the table and column to be used. The text_ptr parameter specifies the text pointer to be checked. This function will return 0 if the pointer is invalid and 1 if the pointer is valid.

B Very Simple Connectivity Examples Entire books are written around the subject of connectivity. For the first several books I put out, I deliberately avoided the topic entirely in the basic belief that it is a simply huge topic — one that is difficult to do justice to in less than a full book. That said, having a SQL Server but not allowing programs to connect to it is the same as not having a SQL Server at all. Sure, we may log into Management Studio and write queries directly, but the reality is that the vast majority of our users out there never actually see the database directly. For this “Beginning” title, I’m still going to touch on the subject only in a very limited fashion that is purely meant for quick reference once you’ve looked at other sources, or perhaps to give you an inkling of what is involved. If you’re serious about displaying excellence in working with SQL Server or any other connectivity-based data solution, I highly recommend you purchase a book specifically on data access and connectivity. This appendix is a collection of extremely simple connectivity examples utilizing a couple of client languages and a few features in two different connectivity models. We’re going to stick a few basic examples of connecting within each language/model mix and leave the discussion of the whys and hows to books that are focused solely on connectivity. I can’t stress enough how these examples are truly the basics. You can make many, many choices and optimizations for connectivity. Each connectivity model has its own quirks, and different languages sometimes bring their own flair. If you’re trying to get more out of this than just a basic feel for how it’s done (or perhaps an “Oh yeah, I forgot that part”), check out the connectivity coverage I offer in Professional SQL Server 2008 Programming or perhaps another connectivity-specific book. (There are likely entire books just for your particular language and connectivity model mix.) Connectivity models covered here include: ❑ ADO.NET ❑ ADO

Appendix A: System Functions<br />

Text and Image Functions<br />

The text and image functions perform operations on text or image data. They are:<br />

❑ PATINDEX (This was covered in the “String Functions” section earlier in the appendix.)<br />

❑ TEXTPTR<br />

❑ TEXTVALID<br />

TEXTPTR<br />

The TEXTPTR function checks the value of the text pointer that corresponds to a text, ntext, or image<br />

column and returns a varbinary value. The text pointer should be checked to ensure that it points to<br />

the first text page before running READTEXT, WRITETEXT, and UPDATE statements. The syntax is as<br />

follows:<br />

TEXTPTR()<br />

TEXTVALID<br />

648<br />

The TEXTVALID function checks whether a specified text pointer is valid. The syntax is as follows:<br />

TEXTVALID(‘’, )<br />

The table.column parameter specifies the name of the table and column to be used. The text_ptr<br />

parameter specifies the text pointer to be checked.<br />

This function will return 0 if the pointer is invalid and 1 if the pointer is valid.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!