Re: PRINT statement?
Microsoft did not invent the concept of outputting a user-defined line of text; I'm not going to research this but I doubt if they invented using the word PRINT for it either. Also, EVERY vendor includes extensions to the standard (I just happen to know the keywords for the T-SQL ones since that is what I get paid for). I'm not here to discuss people's religious beliefs, I'm here to learn what MySQL can and can not do. Peter Brawley wrote: Stephen Cook wrote: There are such things as extensions to the standard, and many languages besides BASIC that have the ability to output a character string. No need to be snippy. The preference expressed is to that SQL not be bowdlerised into Microsoftese. PB - I will look into the --silent option, thanks! Peter Brawley wrote: Stephen Cook wrote: I appreciate it but SELECT isn't quite what I want. It adds an extra 4 to 6 lines to the output (drawing the table, headers, row counts, etc). PRINT simply outputs whatever comes after it: PRINT is not a SQL command. The mysql client (fortunately) does not speak Basic. To minimise output in the mysql client, have a look at the -s --silent option. PB - PRINT 'hey you!' would show: hey you! Not a big deal I suppose but it makes for a lot more scrolling around. I've started just dumping the comments (i.e. '') into a table with a timestamp, so I can review it afterwards. Its a close second. Rhino wrote: Thanks, Quentin, for the documentation. Assuming that the Transact-SQL Help file is using various terms in the same way as MySQL does, particularly string expression and function, I think we will find that the SQL SELECT will do all of the things that Stephen has come to expect from the PRINT statement in MS SQL Server. I've just put together an SQL Script that I think demonstrates that SELECT can do mostl of the same things as the PRINT statement. Here is the script, which works perfectly in MySQL 4.0.15: = select === S C R I P T B E G I N S === as ; select CONNECT TO DATABASE as Action; use tmp; select DROP/CREATE TABLE as Action; drop table if exists users; create table if not exists users (user_id smallint not null, user_fname char(20) not null, user_lname char(20) not null, user_birthdate date not null, user_education_years int not null, primary key(user_id)); select POPULATE TABLE AND DISPLAY CONTENTS as Action; insert into users values (1, 'Alan', 'Adams', '1970-04-08', 15), (2, 'Bill', 'Baker', '1964-02-01', 18), (3, 'Cass', 'Cooke', '1981-12-04', 12), (4, 'Dina', 'Davis', '1944-06-06', 19), (5, 'Earl', 'Edger', '1990-08-02', 17); select * from users; select SET AND DISPLAY SCRIPT VARIABLES as Action; set @minimum_education_years = 16; set @birthdate_of_youngest_legal_worker = date_sub(curdate(), interval 16 year); select as Variable, as Value UNION select minimum_education_years=, @minimum_education_years UNION select birthdate_of_youngest_legal_worker=, @birthdate_of_youngest_legal_worker; select as Variable, as Value UNION select minimum_education_years=, @minimum_education_years UNION select birthdate_of_youngest_legal_worker=, @birthdate_of_youngest_legal_worker; select EXECUTE QUERIES THAT USE SCRIPT VARIABLES as Action; select concat(Get users who have more than , @minimum_education_years, years of education) as Query; select * from users where user_education_years = @minimum_education_years; select concat(Get users who are old enough to work, i.e. were born before , @birthdate_of_youngest_legal_worker) as Query; select * from users where user_birthdate = @legal_to_work; select DISPLAY FUNCTION RESULTS as Action; select as Function, as Value UNION select curdate()=, curdate() UNION select now()=, now() UNION select Firstname+Lastname=, concat(user_fname, ' ', user_lname) from users where user_id = 1; select === S C R I P T E N D S === as ; = and this is the output of the script: = +---+ | | +---+ | === S C R I P T B E G I N S === | +---+ 1 row in set (0.00 sec) +-+ | Action | +-+ | CONNECT TO DATABASE | +-+ 1 row in set (0.00 sec) Database changed +---+ | Action| +---+ | DROP/CREATE TABLE | +---+ 1 row in set (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) +-+ | Action | +-+ | POPULATE TABLE
Re: PRINT statement?
There are such things as extensions to the standard, and many languages besides BASIC that have the ability to output a character string. No need to be snippy. I will look into the --silent option, thanks! Peter Brawley wrote: Stephen Cook wrote: I appreciate it but SELECT isn't quite what I want. It adds an extra 4 to 6 lines to the output (drawing the table, headers, row counts, etc). PRINT simply outputs whatever comes after it: PRINT is not a SQL command. The mysql client (fortunately) does not speak Basic. To minimise output in the mysql client, have a look at the -s --silent option. PB - PRINT 'hey you!' would show: hey you! Not a big deal I suppose but it makes for a lot more scrolling around. I've started just dumping the comments (i.e. '') into a table with a timestamp, so I can review it afterwards. Its a close second. Rhino wrote: Thanks, Quentin, for the documentation. Assuming that the Transact-SQL Help file is using various terms in the same way as MySQL does, particularly string expression and function, I think we will find that the SQL SELECT will do all of the things that Stephen has come to expect from the PRINT statement in MS SQL Server. I've just put together an SQL Script that I think demonstrates that SELECT can do mostl of the same things as the PRINT statement. Here is the script, which works perfectly in MySQL 4.0.15: = select === S C R I P T B E G I N S === as ; select CONNECT TO DATABASE as Action; use tmp; select DROP/CREATE TABLE as Action; drop table if exists users; create table if not exists users (user_id smallint not null, user_fname char(20) not null, user_lname char(20) not null, user_birthdate date not null, user_education_years int not null, primary key(user_id)); select POPULATE TABLE AND DISPLAY CONTENTS as Action; insert into users values (1, 'Alan', 'Adams', '1970-04-08', 15), (2, 'Bill', 'Baker', '1964-02-01', 18), (3, 'Cass', 'Cooke', '1981-12-04', 12), (4, 'Dina', 'Davis', '1944-06-06', 19), (5, 'Earl', 'Edger', '1990-08-02', 17); select * from users; select SET AND DISPLAY SCRIPT VARIABLES as Action; set @minimum_education_years = 16; set @birthdate_of_youngest_legal_worker = date_sub(curdate(), interval 16 year); select as Variable, as Value UNION select minimum_education_years=, @minimum_education_years UNION select birthdate_of_youngest_legal_worker=, @birthdate_of_youngest_legal_worker; select as Variable, as Value UNION select minimum_education_years=, @minimum_education_years UNION select birthdate_of_youngest_legal_worker=, @birthdate_of_youngest_legal_worker; select EXECUTE QUERIES THAT USE SCRIPT VARIABLES as Action; select concat(Get users who have more than , @minimum_education_years, years of education) as Query; select * from users where user_education_years = @minimum_education_years; select concat(Get users who are old enough to work, i.e. were born before , @birthdate_of_youngest_legal_worker) as Query; select * from users where user_birthdate = @legal_to_work; select DISPLAY FUNCTION RESULTS as Action; select as Function, as Value UNION select curdate()=, curdate() UNION select now()=, now() UNION select Firstname+Lastname=, concat(user_fname, ' ', user_lname) from users where user_id = 1; select === S C R I P T E N D S === as ; = and this is the output of the script: = +---+ | | +---+ | === S C R I P T B E G I N S === | +---+ 1 row in set (0.00 sec) +-+ | Action | +-+ | CONNECT TO DATABASE | +-+ 1 row in set (0.00 sec) Database changed +---+ | Action| +---+ | DROP/CREATE TABLE | +---+ 1 row in set (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) +-+ | Action | +-+ | POPULATE TABLE AND DISPLAY CONTENTS | +-+ 1 row in set (0.00 sec) Query OK, 5 rows affected (0.00 sec) Records: 5 Duplicates: 0 Warnings: 0 +-++++--+ | user_id | user_fname | user_lname | user_birthdate | user_education_years | +-++++--+ | 1 | Alan | Adams | 1970-04-08 | 15 | | 2 | Bill | Baker | 1964-02-01 | 18 | | 3
Re: PRINT statement?
Stephen Cook wrote: There are such things as extensions to the standard, and many languages besides BASIC that have the ability to output a character string. No need to be snippy. I will look into the --silent option, thanks! I also tend to use -BN with these kind of scripts: mysql -u user -BN dbname file.sql mysql -u root -BN -e SHOW DATABASES etc. Regards Mark -- Mark Leith, Support Engineer MySQL AB, Worcester, England, www.mysql.com Are you MySQL certified? www.mysql.com/certification -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: PRINT statement?
Stephen Cook wrote: There are such things as extensions to the standard, and many languages besides BASIC that have the ability to output a character string. No need to be snippy. The preference expressed is to that SQL not be bowdlerised into Microsoftese. PB - I will look into the --silent option, thanks! Peter Brawley wrote: Stephen Cook wrote: I appreciate it but SELECT isn't quite what I want. It adds an extra 4 to 6 lines to the output (drawing the table, headers, row counts, etc). PRINT simply outputs whatever comes after it: PRINT is not a SQL command. The mysql client (fortunately) does not speak Basic. To minimise output in the mysql client, have a look at the -s --silent option. PB - PRINT 'hey you!' would show: hey you! Not a big deal I suppose but it makes for a lot more scrolling around. I've started just dumping the comments (i.e. '') into a table with a timestamp, so I can review it afterwards. Its a close second. Rhino wrote: Thanks, Quentin, for the documentation. Assuming that the Transact-SQL Help file is using various terms in the same way as MySQL does, particularly string expression and function, I think we will find that the SQL SELECT will do all of the things that Stephen has come to expect from the PRINT statement in MS SQL Server. I've just put together an SQL Script that I think demonstrates that SELECT can do mostl of the same things as the PRINT statement. Here is the script, which works perfectly in MySQL 4.0.15: = select === S C R I P T B E G I N S === as ; select CONNECT TO DATABASE as Action; use tmp; select DROP/CREATE TABLE as Action; drop table if exists users; create table if not exists users (user_id smallint not null, user_fname char(20) not null, user_lname char(20) not null, user_birthdate date not null, user_education_years int not null, primary key(user_id)); select POPULATE TABLE AND DISPLAY CONTENTS as Action; insert into users values (1, 'Alan', 'Adams', '1970-04-08', 15), (2, 'Bill', 'Baker', '1964-02-01', 18), (3, 'Cass', 'Cooke', '1981-12-04', 12), (4, 'Dina', 'Davis', '1944-06-06', 19), (5, 'Earl', 'Edger', '1990-08-02', 17); select * from users; select SET AND DISPLAY SCRIPT VARIABLES as Action; set @minimum_education_years = 16; set @birthdate_of_youngest_legal_worker = date_sub(curdate(), interval 16 year); select as Variable, as Value UNION select minimum_education_years=, @minimum_education_years UNION select birthdate_of_youngest_legal_worker=, @birthdate_of_youngest_legal_worker; select as Variable, as Value UNION select minimum_education_years=, @minimum_education_years UNION select birthdate_of_youngest_legal_worker=, @birthdate_of_youngest_legal_worker; select EXECUTE QUERIES THAT USE SCRIPT VARIABLES as Action; select concat(Get users who have more than , @minimum_education_years, years of education) as Query; select * from users where user_education_years = @minimum_education_years; select concat(Get users who are old enough to work, i.e. were born before , @birthdate_of_youngest_legal_worker) as Query; select * from users where user_birthdate = @legal_to_work; select DISPLAY FUNCTION RESULTS as Action; select as Function, as Value UNION select curdate()=, curdate() UNION select now()=, now() UNION select Firstname+Lastname=, concat(user_fname, ' ', user_lname) from users where user_id = 1; select === S C R I P T E N D S === as ; = and this is the output of the script: = +---+ | | +---+ | === S C R I P T B E G I N S === | +---+ 1 row in set (0.00 sec) +-+ | Action | +-+ | CONNECT TO DATABASE | +-+ 1 row in set (0.00 sec) Database changed +---+ | Action| +---+ | DROP/CREATE TABLE | +---+ 1 row in set (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) +-+ | Action | +-+ | POPULATE TABLE AND DISPLAY CONTENTS | +-+ 1 row in set (0.00 sec) Query OK, 5 rows affected (0.00 sec) Records: 5 Duplicates: 0 Warnings: 0 +-++++--+ | user_id | user_fname | user_lname | user_birthdate | user_education_years | +-++++--+ | 1 | Alan | Adams | 1970-04-08
Re: PRINT statement?
Thanks, Quentin, for the documentation. Assuming that the Transact-SQL Help file is using various terms in the same way as MySQL does, particularly string expression and function, I think we will find that the SQL SELECT will do all of the things that Stephen has come to expect from the PRINT statement in MS SQL Server. I've just put together an SQL Script that I think demonstrates that SELECT can do mostl of the same things as the PRINT statement. Here is the script, which works perfectly in MySQL 4.0.15: = select === S C R I P T B E G I N S === as ; select CONNECT TO DATABASE as Action; use tmp; select DROP/CREATE TABLE as Action; drop table if exists users; create table if not exists users (user_id smallint not null, user_fname char(20) not null, user_lname char(20) not null, user_birthdate date not null, user_education_years int not null, primary key(user_id)); select POPULATE TABLE AND DISPLAY CONTENTS as Action; insert into users values (1, 'Alan', 'Adams', '1970-04-08', 15), (2, 'Bill', 'Baker', '1964-02-01', 18), (3, 'Cass', 'Cooke', '1981-12-04', 12), (4, 'Dina', 'Davis', '1944-06-06', 19), (5, 'Earl', 'Edger', '1990-08-02', 17); select * from users; select SET AND DISPLAY SCRIPT VARIABLES as Action; set @minimum_education_years = 16; set @birthdate_of_youngest_legal_worker = date_sub(curdate(), interval 16 year); select as Variable, as Value UNION select minimum_education_years=, @minimum_education_years UNION select birthdate_of_youngest_legal_worker=, @birthdate_of_youngest_legal_worker; select as Variable, as Value UNION select minimum_education_years=, @minimum_education_years UNION select birthdate_of_youngest_legal_worker=, @birthdate_of_youngest_legal_worker; select EXECUTE QUERIES THAT USE SCRIPT VARIABLES as Action; select concat(Get users who have more than , @minimum_education_years, years of education) as Query; select * from users where user_education_years = @minimum_education_years; select concat(Get users who are old enough to work, i.e. were born before , @birthdate_of_youngest_legal_worker) as Query; select * from users where user_birthdate = @legal_to_work; select DISPLAY FUNCTION RESULTS as Action; select as Function, as Value UNION select curdate()=, curdate() UNION select now()=, now() UNION select Firstname+Lastname=, concat(user_fname, ' ', user_lname) from users where user_id = 1; select === S C R I P T E N D S === as ; = and this is the output of the script: = +---+ | | +---+ | === S C R I P T B E G I N S === | +---+ 1 row in set (0.00 sec) +-+ | Action | +-+ | CONNECT TO DATABASE | +-+ 1 row in set (0.00 sec) Database changed +---+ | Action| +---+ | DROP/CREATE TABLE | +---+ 1 row in set (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) +-+ | Action | +-+ | POPULATE TABLE AND DISPLAY CONTENTS | +-+ 1 row in set (0.00 sec) Query OK, 5 rows affected (0.00 sec) Records: 5 Duplicates: 0 Warnings: 0 +-++++--+ | user_id | user_fname | user_lname | user_birthdate | user_education_years | +-++++--+ | 1 | Alan | Adams | 1970-04-08 | 15 | | 2 | Bill | Baker | 1964-02-01 | 18 | | 3 | Cass | Cooke | 1981-12-04 | 12 | | 4 | Dina | Davis | 1944-06-06 | 19 | | 5 | Earl | Edger | 1990-08-02 | 17 | +-++++--+ 5 rows in set (0.00 sec) +--+ | Action | +--+ | SET AND DISPLAY SCRIPT VARIABLES | +--+ 1 row in set (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) +-++ | Variable| Value | +-++ | || | minimum_education_years=| 16
Re: PRINT statement?
I appreciate it but SELECT isn't quite what I want. It adds an extra 4 to 6 lines to the output (drawing the table, headers, row counts, etc). PRINT simply outputs whatever comes after it: PRINT 'hey you!' would show: hey you! Not a big deal I suppose but it makes for a lot more scrolling around. I've started just dumping the comments (i.e. '') into a table with a timestamp, so I can review it afterwards. Its a close second. Rhino wrote: Thanks, Quentin, for the documentation. Assuming that the Transact-SQL Help file is using various terms in the same way as MySQL does, particularly string expression and function, I think we will find that the SQL SELECT will do all of the things that Stephen has come to expect from the PRINT statement in MS SQL Server. I've just put together an SQL Script that I think demonstrates that SELECT can do mostl of the same things as the PRINT statement. Here is the script, which works perfectly in MySQL 4.0.15: = select === S C R I P T B E G I N S === as ; select CONNECT TO DATABASE as Action; use tmp; select DROP/CREATE TABLE as Action; drop table if exists users; create table if not exists users (user_id smallint not null, user_fname char(20) not null, user_lname char(20) not null, user_birthdate date not null, user_education_years int not null, primary key(user_id)); select POPULATE TABLE AND DISPLAY CONTENTS as Action; insert into users values (1, 'Alan', 'Adams', '1970-04-08', 15), (2, 'Bill', 'Baker', '1964-02-01', 18), (3, 'Cass', 'Cooke', '1981-12-04', 12), (4, 'Dina', 'Davis', '1944-06-06', 19), (5, 'Earl', 'Edger', '1990-08-02', 17); select * from users; select SET AND DISPLAY SCRIPT VARIABLES as Action; set @minimum_education_years = 16; set @birthdate_of_youngest_legal_worker = date_sub(curdate(), interval 16 year); select as Variable, as Value UNION select minimum_education_years=, @minimum_education_years UNION select birthdate_of_youngest_legal_worker=, @birthdate_of_youngest_legal_worker; select as Variable, as Value UNION select minimum_education_years=, @minimum_education_years UNION select birthdate_of_youngest_legal_worker=, @birthdate_of_youngest_legal_worker; select EXECUTE QUERIES THAT USE SCRIPT VARIABLES as Action; select concat(Get users who have more than , @minimum_education_years, years of education) as Query; select * from users where user_education_years = @minimum_education_years; select concat(Get users who are old enough to work, i.e. were born before , @birthdate_of_youngest_legal_worker) as Query; select * from users where user_birthdate = @legal_to_work; select DISPLAY FUNCTION RESULTS as Action; select as Function, as Value UNION select curdate()=, curdate() UNION select now()=, now() UNION select Firstname+Lastname=, concat(user_fname, ' ', user_lname) from users where user_id = 1; select === S C R I P T E N D S === as ; = and this is the output of the script: = +---+ | | +---+ | === S C R I P T B E G I N S === | +---+ 1 row in set (0.00 sec) +-+ | Action | +-+ | CONNECT TO DATABASE | +-+ 1 row in set (0.00 sec) Database changed +---+ | Action| +---+ | DROP/CREATE TABLE | +---+ 1 row in set (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) +-+ | Action | +-+ | POPULATE TABLE AND DISPLAY CONTENTS | +-+ 1 row in set (0.00 sec) Query OK, 5 rows affected (0.00 sec) Records: 5 Duplicates: 0 Warnings: 0 +-++++--+ | user_id | user_fname | user_lname | user_birthdate | user_education_years | +-++++--+ | 1 | Alan | Adams | 1970-04-08 | 15 | | 2 | Bill | Baker | 1964-02-01 | 18 | | 3 | Cass | Cooke | 1981-12-04 | 12 | | 4 | Dina | Davis | 1944-06-06 | 19 | | 5 | Earl | Edger | 1990-08-02 | 17 | +-++++--+ 5 rows in set (0.00 sec) +--+ | Action
Re: PRINT statement?
Stephen Cook wrote: I appreciate it but SELECT isn't quite what I want. It adds an extra 4 to 6 lines to the output (drawing the table, headers, row counts, etc). PRINT simply outputs whatever comes after it: PRINT is not a SQL command. The mysql client (fortunately) does not speak Basic. To minimise output in the mysql client, have a look at the -s --silent option. PB - PRINT 'hey you!' would show: hey you! Not a big deal I suppose but it makes for a lot more scrolling around. I've started just dumping the comments (i.e. '') into a table with a timestamp, so I can review it afterwards. Its a close second. Rhino wrote: Thanks, Quentin, for the documentation. Assuming that the Transact-SQL Help file is using various terms in the same way as MySQL does, particularly string expression and function, I think we will find that the SQL SELECT will do all of the things that Stephen has come to expect from the PRINT statement in MS SQL Server. I've just put together an SQL Script that I think demonstrates that SELECT can do mostl of the same things as the PRINT statement. Here is the script, which works perfectly in MySQL 4.0.15: = select === S C R I P T B E G I N S === as ; select CONNECT TO DATABASE as Action; use tmp; select DROP/CREATE TABLE as Action; drop table if exists users; create table if not exists users (user_id smallint not null, user_fname char(20) not null, user_lname char(20) not null, user_birthdate date not null, user_education_years int not null, primary key(user_id)); select POPULATE TABLE AND DISPLAY CONTENTS as Action; insert into users values (1, 'Alan', 'Adams', '1970-04-08', 15), (2, 'Bill', 'Baker', '1964-02-01', 18), (3, 'Cass', 'Cooke', '1981-12-04', 12), (4, 'Dina', 'Davis', '1944-06-06', 19), (5, 'Earl', 'Edger', '1990-08-02', 17); select * from users; select SET AND DISPLAY SCRIPT VARIABLES as Action; set @minimum_education_years = 16; set @birthdate_of_youngest_legal_worker = date_sub(curdate(), interval 16 year); select as Variable, as Value UNION select minimum_education_years=, @minimum_education_years UNION select birthdate_of_youngest_legal_worker=, @birthdate_of_youngest_legal_worker; select as Variable, as Value UNION select minimum_education_years=, @minimum_education_years UNION select birthdate_of_youngest_legal_worker=, @birthdate_of_youngest_legal_worker; select EXECUTE QUERIES THAT USE SCRIPT VARIABLES as Action; select concat(Get users who have more than , @minimum_education_years, years of education) as Query; select * from users where user_education_years = @minimum_education_years; select concat(Get users who are old enough to work, i.e. were born before , @birthdate_of_youngest_legal_worker) as Query; select * from users where user_birthdate = @legal_to_work; select DISPLAY FUNCTION RESULTS as Action; select as Function, as Value UNION select curdate()=, curdate() UNION select now()=, now() UNION select Firstname+Lastname=, concat(user_fname, ' ', user_lname) from users where user_id = 1; select === S C R I P T E N D S === as ; = and this is the output of the script: = +---+ | | +---+ | === S C R I P T B E G I N S === | +---+ 1 row in set (0.00 sec) +-+ | Action | +-+ | CONNECT TO DATABASE | +-+ 1 row in set (0.00 sec) Database changed +---+ | Action| +---+ | DROP/CREATE TABLE | +---+ 1 row in set (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) +-+ | Action | +-+ | POPULATE TABLE AND DISPLAY CONTENTS | +-+ 1 row in set (0.00 sec) Query OK, 5 rows affected (0.00 sec) Records: 5 Duplicates: 0 Warnings: 0 +-++++--+ | user_id | user_fname | user_lname | user_birthdate | user_education_years | +-++++--+ | 1 | Alan | Adams | 1970-04-08 | 15 | | 2 | Bill | Baker | 1964-02-01 | 18 | | 3 | Cass | Cooke | 1981-12-04 | 12 | | 4 | Dina | Davis | 1944-06-06 | 19 | | 5 | Earl | Edger | 1990-08-02 | 17
Re: PRINT statement?
I've started using the SELECT with no other clauses but I am still curious about a PRINT-like command. It is for SQL scripts. Rhino wrote: - Original Message - From: Stephen Cook [EMAIL PROTECTED] To: MySQL List mysql@lists.mysql.com Sent: Sunday, May 07, 2006 3:53 AM Subject: PRINT statement? Is there a statement similar to PRINT in T-SQL (MicroSoft SQL Server)? It would be handy to debug some scripts. If you're talking about a script that is running SQL, you can simply use the SELECT statement without any FROM, WHERE, ORDER BY, GROUP BY or HAVING clauses. For example: select Creating Foo table as Action; will produce the following output: +--+ | Action | +--+ | Creating Foo table | +--+ 1 row in set (0.00 sec) If you're talking about an OS script, you can use OS commands to display things. For example, I have some BASH scripts on our Linux server so I can use the BASH echo command, like this: #!/bin/bash report_date=`/bin/date` echo Report Date: $report_date; to produce this output: Report Date: Sun May 7 09:42:57 EDT 2006 -- Rhino -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: PRINT statement?
I am not familiar with the PRINT command so I don't know what it does. I played with MS SQL Server once for a couple of days a few years back and that is the only contact I've ever had with SQL Server. If you can tell me what PRINT does, in detail, maybe I can suggest another alternative. -- Rhino - Original Message - From: Stephen Cook [EMAIL PROTECTED] To: Rhino [EMAIL PROTECTED] Cc: MySQL List mysql@lists.mysql.com Sent: Wednesday, May 10, 2006 8:09 PM Subject: Re: PRINT statement? I've started using the SELECT with no other clauses but I am still curious about a PRINT-like command. It is for SQL scripts. Rhino wrote: - Original Message - From: Stephen Cook [EMAIL PROTECTED] To: MySQL List mysql@lists.mysql.com Sent: Sunday, May 07, 2006 3:53 AM Subject: PRINT statement? Is there a statement similar to PRINT in T-SQL (MicroSoft SQL Server)? It would be handy to debug some scripts. If you're talking about a script that is running SQL, you can simply use the SELECT statement without any FROM, WHERE, ORDER BY, GROUP BY or HAVING clauses. For example: select Creating Foo table as Action; will produce the following output: +--+ | Action | +--+ | Creating Foo table | +--+ 1 row in set (0.00 sec) If you're talking about an OS script, you can use OS commands to display things. For example, I have some BASH scripts on our Linux server so I can use the BASH echo command, like this: #!/bin/bash report_date=`/bin/date` echo Report Date: $report_date; to produce this output: Report Date: Sun May 7 09:42:57 EDT 2006 -- Rhino -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.392 / Virus Database: 268.5.5/335 - Release Date: 09/05/2006 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.392 / Virus Database: 268.5.5/335 - Release Date: 09/05/2006 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: PRINT statement?
From Transact-SQL Help file: PRINT Returns a user-defined message to the client. Syntax PRINT 'any ASCII text' | @local_variable | @@FUNCTION | string_expr Arguments 'any ASCII text' Is a string of text. @local_variable Is a variable of any valid character data type. @local_variable must be char or varchar, or be able to be implicitly converted to those data types. @@FUNCTION Is a function that returns string results. @@FUNCTION must be char or varchar, or be able to be implicitly converted to those data types. string_expr Is an expression that returns a string. Can include concatenated literal values and variables. The message string can be up to 8,000 characters long; any characters after 8,000 are truncated. -Original Message- From: Rhino [mailto:[EMAIL PROTECTED] Sent: Thursday, 11 May 2006 3:51 p.m. To: Stephen Cook Cc: MySQL List Subject: Re: PRINT statement? I am not familiar with the PRINT command so I don't know what it does. I played with MS SQL Server once for a couple of days a few years back and that is the only contact I've ever had with SQL Server. If you can tell me what PRINT does, in detail, maybe I can suggest another alternative. -- Rhino - Original Message - From: Stephen Cook [EMAIL PROTECTED] To: Rhino [EMAIL PROTECTED] Cc: MySQL List mysql@lists.mysql.com Sent: Wednesday, May 10, 2006 8:09 PM Subject: Re: PRINT statement? I've started using the SELECT with no other clauses but I am still curious about a PRINT-like command. It is for SQL scripts. Rhino wrote: - Original Message - From: Stephen Cook [EMAIL PROTECTED] To: MySQL List mysql@lists.mysql.com Sent: Sunday, May 07, 2006 3:53 AM Subject: PRINT statement? Is there a statement similar to PRINT in T-SQL (MicroSoft SQL Server)? It would be handy to debug some scripts. If you're talking about a script that is running SQL, you can simply use the SELECT statement without any FROM, WHERE, ORDER BY, GROUP BY or HAVING clauses. For example: select Creating Foo table as Action; will produce the following output: +--+ | Action | +--+ | Creating Foo table | +--+ 1 row in set (0.00 sec) If you're talking about an OS script, you can use OS commands to display things. For example, I have some BASH scripts on our Linux server so I can use the BASH echo command, like this: #!/bin/bash report_date=`/bin/date` echo Report Date: $report_date; to produce this output: Report Date: Sun May 7 09:42:57 EDT 2006 -- Rhino -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.392 / Virus Database: 268.5.5/335 - Release Date: 09/05/2006 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.392 / Virus Database: 268.5.5/335 - Release Date: 09/05/2006 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] The information contained in this email is privileged and confidential and intended for the addressee only. If you are not the intended recipient, you are asked to respect that confidentiality and not disclose, copy or make use of its contents. If received in error you are asked to destroy this email and contact the sender immediately. Your assistance is appreciated. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
PRINT statement?
Is there a statement similar to PRINT in T-SQL (MicroSoft SQL Server)? It would be handy to debug some scripts. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: PRINT statement?
- Original Message - From: Stephen Cook [EMAIL PROTECTED] To: MySQL List mysql@lists.mysql.com Sent: Sunday, May 07, 2006 3:53 AM Subject: PRINT statement? Is there a statement similar to PRINT in T-SQL (MicroSoft SQL Server)? It would be handy to debug some scripts. If you're talking about a script that is running SQL, you can simply use the SELECT statement without any FROM, WHERE, ORDER BY, GROUP BY or HAVING clauses. For example: select Creating Foo table as Action; will produce the following output: +--+ | Action | +--+ | Creating Foo table | +--+ 1 row in set (0.00 sec) If you're talking about an OS script, you can use OS commands to display things. For example, I have some BASH scripts on our Linux server so I can use the BASH echo command, like this: #!/bin/bash report_date=`/bin/date` echo Report Date: $report_date; to produce this output: Report Date: Sun May 7 09:42:57 EDT 2006 -- Rhino -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.392 / Virus Database: 268.5.5/333 - Release Date: 05/05/2006 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]