working on it ...

Filters

Explore Public Snippets

Sort by

Found 6 snippets matching: Language=SQL AND DBMS=MySQL

    public by cghersi modified Jan 4, 2013  2641  1  7  0

    Call Stored Procedure with OUT or INOUT parameters in MySQL

    This is how to call a stored procedure "MySP" with a parameter defined as INOUT directyl from SQL environment
    DELIMITER $$
    CREATE PROCEDURE MySP(
    	IN _Ip VARCHAR(20),
    	INOUT _Id INT
    )
    BEGIN
    	SELECT  Id INTO _Id 
    	FROM    `MyTable`
    	WHERE   Ip = _Ip ;
    END $$
    DELIMITER ;
    
    SET @a = 1;
    CALL MySP('192.168.2.3', @a);

    public by cghersi modified Nov 8, 2012  2297  0  6  0

    Run .sql files from Mysql command line

    This is the command to run an external .sql file from MySql
    mysql>\. <absolute_path_to_sql_file>

    public by cghersi modified Nov 5, 2015  2013  0  6  0

    Get estimate of number of records in MySQL tables

    This query returns the number of records present in each table. It is not totally accurate, but can give a rough estimate of the sizes of the tables.
    SELECT table_name, table_rows
    FROM INFORMATION_SCHEMA.TABLES
    WHERE TABLE_SCHEMA = 'MyDb';          

    public by cghersi modified Nov 8, 2012  1788  1  5  0

    Create a user in MySql

    This is how to create a SQL user programmatically; it also gives the user the visibility from local machine and external machines
    CREATE USER 'username'@'localhost' IDENTIFIED BY 'my_password';
    CREATE USER 'username'@'%' IDENTIFIED BY 'my_password';

    public by cghersi modified Nov 11, 2012  1871  0  6  0

    Grant privileges to SQL user in MySql

    This is how to allow a user to see a particular schema in MySQL
    GRANT ALL PRIVILEGES ON MySchema.* TO 'myuser'@'localhost' WITH GRANT OPTION;
    GRANT ALL PRIVILEGES ON MySchema.* TO 'myuser'@'%' WITH GRANT OPTION;

    public by marksimon232 modified Aug 12, 2014  2547  1  6  4

    Most efficient way to perform a FullText Search on SQL MS Azure

    On Azure SQL Database the FullText Search is not enabled, so what is the best way to do a similar search with acceptable performances? Using LIKE operator is not an option for large databases...
    SQL Azure Database does not currently (August 2014) support Full Text Search. Many requiring this functionality have opted to use Lucene.NET instead. There's a useful overview of Lucene.NET plus code samples below:
    
    Lucene.NET Overview and Code Samples: 
    http://leoncullens.nl/post/2012/11/18/Full-Text-Search-on-Azure-with-LuceneNET.aspx
    
    I was able to create a working demo against one of my own SQL Azure tables in about 10 minutes.
    var indexWriter = new IndexWriter(azureDir, new StandardAnalyzer(Version.LUCENE_30), true, IndexWriter.MaxFieldLength.UNLIMITED);

    List Complete ( 6 snippets total )

    • Public Snippets
    • Channels Snippets