filmov
tv
Stored Procedure Programming Concepts - Print | Essential SQL

Показать описание
We use print to display a message. Very simple of using print would to be to display "Hello world." The print displays text. The text is enclosed in single quotes and the command ends with a semicolon. You can also use print with variables. For instance, I can declare a variable such as VARCHAR, like my variable. I can set it to some characters and then I can just print the variable. In this case, I have a variable called my variable. I'm setting it to, "I like SQL," then I print my variable. That will print the message, "I like SQL."
You can also declare a numeric value and then convert that to a character and print the value. The key here is that when you're using print, you are printing text. If you have other variables, or values, they need to be first converted to text before they can participate in the print commands. In this case, with this expression, we are casting our row variable, which is an integer, into a VARCHAR and then printing it.
Let's look at some quick examples.