473,385 Members | 1,602 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

SHOW TABLES & SQL_CALC_FOUND_ROWS

Good morning

I wish to do the following:

1. return an integer (0 or 1) whether a table exists in the database
otherwise I will create the table
Problem: instead of returning an integer I am being returned the "table
name" if it exists, or a NULL.

Now I understand that I need to use "SQL_CALC_FOUND_ROWS" but I am
unsure of how to implement that here.

Can anyone help ?

Thank you

Peter


My code so far:

DELIMITER $$;

DROP PROCEDURE IF EXISTS `Research`.`spTableExists`$$

CREATE PROCEDURE `spTableExists`(tableName varchar (5))
BEGIN
DECLARE MyTable VARCHAR(512);

SET @MyTable = concat('SHOW TABLES FROM MyDatabase LIKE ',"'",
tableName, "%'");

PREPARE stmt1 FROM @MyTable;
EXECUTE stmt1;
DEALLOCATE PREPARE stmt1;

SELECT FOUND_ROWS();

END$$

DELIMITER ;$$

Jan 23 '06 #1
0 1178

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Leigh | last post by:
Hi, I am trying to buld a new module for phpnuke, the index.php page just to display a simple menu, the code forthe menu is below function set_menu() { global $module_name;...
0
by: Vladimir Trebicky | last post by:
Hi, I've been trying to solve this problem for a long time. Only thing I did when upgrading from 3.25 to 4.0.14 I took the default my.cnf. I did not convert the privilege tables with...
0
by: Jerry | last post by:
The "SHOW TABLE STATUS" command seems to return a result set, just like "SELECT * FROM SomeTable". Therefore, since the following is valid: SELECT * FROM (SELECT * FROM SomeTable) I...
44
by: Mariusz Jedrzejewski | last post by:
Hi, I'll be very grateful if somebody can explain me why my Opera 7.23 (runing under linux) doesn't show me inner tables. Using below code I can see only "inner table 1". There is no problem with...
1
by: knoak | last post by:
Hi there, I have a site rendered from a mySQL DB, and it displays products. Each product is shown in it's own table with a picture, and some additional information. It looks like this:...
2
by: J Sahoo | last post by:
Hi, I have a browse page where I am showing few fields from my SQL Server table. One of the field is Image type, all the fields are bound to a single table. I want to show the image from the...
1
by: Stefan van Roosmalen | last post by:
Hi there, Is there a way to list the TEMPORATY tables? I have tried SHOW TABLES, but this command only list the regular tables. Thank you very much for your answer. Regards, Stefan.
0
by: arti | last post by:
I want to show Countries & their states (indented to right under corresponding country) in a single Listbox. It should get data from 2 tables related by CountryId in database. Pl help! eg, India...
8
by: obtrs | last post by:
show data of multiple tables? i have 3 tables i want to show the data from them to a page. table1 "trip" table2 "seat" table3 "user_information" show all the data of table one which is...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.