|
Hi,
iam using MySql db,
my stored procedure is like this..
DELIMITER $$
DROP PROCEDURE IF EXISTS `test`.`IS_CITY_EXISTS` $$
CREATE PROCEDURE `IS_CITY_EXISTS`(
IN CITYNAME VARCHAR(45),
OUT AVAILABLE BOOLEAN
)
BEGIN
IF EXISTS(SELECT * FROM city_details WHERE city_name=CITYNAME) THEN
SELECT 1 INTO AVAILABLE;
ELSE
SELECT 0 INTO AVAILABLE;
END IF;
END $$
DELIMITER ;
when iam executing this procedure works fine..
CALL IS_CITY_EXISTS('kak',@Available);
but while exceuting SELECT @AVAILABLE;--IT'S giving result null.
is there any error in procedure..
how can i call this procedure in (c#)..
murali krishna
|
|
|
|
|
I've never used MySQL but two observations still:
- you set delimiter to $$. However you use semicolon after the statements.
- is 0 equal to false in mysql or does it understand false keyword. If so, 0 may be interpreted to null since it's not false.
But then again, just guessing.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Is there anybody show me how to create Function in MySql database?
I need it urgently.
I have been seeking and trying for 2 days.
but not succeed.
i m trying to extract only number from a given string.
but everytime i try, it show error msg (syntax error)
could anybody has a sample function in mysql database pls?
thanks in advance!
|
|
|
|
|
kyi kyi wrote: I need it urgently.
Not that urgently or you would have tried here[^] - loads of samples.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Quit cross posting.
kyi kyi wrote: I need it urgently.
Oh well, that's your problem. Not mine or anyone else's.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Hi all .
I wount to restore the DataBase But the restore operation is Feild and get me the Error int message : " System.Data.SqlClient.SqlError : The Operating System returned the error '5(error not found)' while attempting 'Restore Container :: ValidationTargetForCreation' on (Microsoft.SqlServer.Express.Smo)" .
What is the Error Meaning and How i Can Solve it ??
Thanks For Any boudy hellp me
Thaer
|
|
|
|
|
Most likely the file you're trying to restore does not exist or the directory is wrong. Remember that when you issue a restore command, the file must be defined in a way how SQL Server service sees it.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
How to Following the steps that I define aconnection Between My Server And The Client Pc ..
thanks...
jetwll
|
|
|
|
|
Try here [^]
Bob
Ashfield Consultants Ltd
|
|
|
|
|
I want to retrieve top 2 of maximum salary records.What wud be the qeury???
|
|
|
|
|
If you've got only one table containing all salaries, your answer is as simple as this:
SELECT TOP(2) Salary
FROM TABLE
ORDER BY Salary DESC
_
|
|
|
|
|
Can u plz tell if I want to get minimum of top 2.
|
|
|
|
|
Order the records in ascending order and select top two
|
|
|
|
|
select top 2 salary from tbl_salary order by salary desc
select top 2 salary from tbl_salary order by salary asc
Errors are like Mini Skirts, shorter they get, more revealing they become.
|
|
|
|
|
Now I got a question for you; Imagine you want to retrieve the top 3 salary records. How would you go about and do that?
|
|
|
|
|
you din understand my question and now making fun of me.'minimum of top 2' means the lesser of the top 2 that is the second largest salary.Now if you are too smart tell this eddyvluggen.
|
|
|
|
|
joindotnet wrote: making fun of me
I was, wasn't I?
joindotnet wrote:
What wud be the qeury???
You just wanted someone to write a query for you, and someone did. Have you actually tried writing the query? If so, why didn't you post the piece that you already wrote?
|
|
|
|
|
I can write the queries by myself. I just wanted to know whether there is a simplification for it
select min(salary) from (select top 2 salary from order by salary desc)
By the way this place is for professionals not for people like u who r here to have fun.
|
|
|
|
|
I didn't know professionals could not have fun. If you ask an oversimple question or break the forum guidelines, you will get flamed.
Blog link to be reinstated at a later date.
|
|
|
|
|
I need to copy rows from datatable to database by using SQLBulkCopy. I am using ODBC connection. How can I use ODBC connection with SQLBulkCopy.
|
|
|
|
|
SQLBulkCopy is a class that is used with native SQL Server connection (SQLConnection). It cannot be used with ODBC connection. If you're using Microsoft ODBC driver for SQL Server, it has enhancements that make it possible to use bulk copy operations, but then the functionality is the same as in bcp, not the same what is defined for SQLBulkCopy.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Hi..
My function is to extract only number from given string.
i m using mysql database and i m new to the syntax.
is there anyone help me pls?
thanks in advance!
=====================
BEGIN
DECLARE @Count INT
DECLARE @IntNumbers VARCHAR(1000)
SET @Count = 0
SET @IntNumbers = ''
WHILE @Count <= LEN(@String)
BEGIN
IF SUBSTRING(@String,@Count,1) >= '0'
AND SUBSTRING(@String,@Count,1) <= '9'
BEGIN
SET @IntNumbers = @IntNumbers + SUBSTRING(@String,@Count,1)
END
SET @Count = @Count + 1
END
RETURN @IntNumbers
=============================================
The following error Message is shown.
Script line: 4 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@locator VARCHAR(20))
RETURNS INT
AS
BEGIN
DECLARE @cnt INT
DECLARE' at line 1
|
|
|
|
|
|
thanks.
i referenced this function.
and it shown the error as i mentioned.
|
|
|
|
|
It's working in SQL Server dude. Since you are trying to execute it on MySql, you probably have to find which line should be replaced with the proper corresponding sql syntax in MySql.
_
|
|
|
|