Search Results

Search found 1805 results on 73 pages for 'varchar'.

Page 48/73 | < Previous Page | 44 45 46 47 48 49 50 51 52 53 54 55  | Next Page >

  • String literals and escape characters in postgresql

    - by rjohnston
    Attempting to insert an escape character into a table results in a warning. For example: create table EscapeTest (text varchar(50)); insert into EscapeTest (text) values ('This is the first part \n And this is the second'); Produces the warning: WARNING: nonstandard use of escape in a string literal (Using PSQL 8.2) Anyone know how to get around this?

    Read the article

  • Import excel file into sql express 2008

    - by ck
    Hi, I've got some excel files, that were exported from tables in Access, and I want to import them into sql express 2005. I need a script that will convert nvarchar(255) columns to varchar(255) and preserve links, when importing the data into sql express. Thanks

    Read the article

  • type casting in mysql

    - by muralikalpana
    i have passportno(varchar) in database. i am entering values like this 001,002,003. and i want to display like sorting order. now i wrote query like this "select * from passport_registration where status=1 ORDER BY passportno" then displaying output like this......077,088,099,100,1000,1001,1009,101,1010 i want to diplay sort order. how to do?

    Read the article

  • How to translate this query:

    - by xRobot
    How can I translate this 2 queries in postgresql ? : . CREATE TABLE example ( id int(10) unsigned NOT NULL auto_increment, from varchar(255) NOT NULL default '0', message text NOT NULL, lastactivity timestamp NULL default '0000-00-00 00:00:00', read int(10) unsigned NOT NULL, PRIMARY KEY (id), KEY from (from) ) DEFAULT CHARSET=utf8; . SELECT * FROM table_1 LEFT OUTER JOIN table_2 ON ( table_1.id = table_2.id ) WHERE (table_1.lastactivity > NOW()-100);

    Read the article

  • How to adjust SQL LIKE function?

    - by slave016
    I want to make this kind of query: create procedure something @name varchar(13) as begin select * from WORKER where NAME LIKE "%@name%" end For input @name=ho, I want output every row that contains NAME wich sounds "ho", for example HOuse, soHO, broHOw...

    Read the article

  • how to solve syntax error in procedure in mysql?

    - by Shooter
    Hi all, i am executing a procedure in mysql, procedure is- delimiter $$ create procedure getFacility (in id int, out MyFacility VARCHAR(200)) begin select Facility into MyFacility from facilities where FacilityID = id ; end $$ delimiter ; and it is giving error below- Error Code : 1064 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 'end $$ delimiter' at line 1 (0 ms taken) how to solve this error? Thanks, Yugal

    Read the article

  • How to translate this 2 queries from Mysql to Postgresql? :

    - by xRobot
    How can I translate this 2 queries in postgresql ? : CREATE TABLE `example` ( `id` int(10) unsigned NOT NULL auto_increment, `from` varchar(255) NOT NULL default '0', `message` text NOT NULL, `lastactivity` timestamp NULL default '0000-00-00 00:00:00', `read` int(10) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `from` (`from`) ) DEFAULT CHARSET=utf8; Query: SELECT * FROM table_1 LEFT OUTER JOIN table_2 ON ( table_1.id = table_2.id ) WHERE (table_1.lastactivity > NOW()-100);

    Read the article

  • Get return values from a stored procedure in c# (login process)

    - by Jin
    Hi all, I am trying to use a Stored Procedure which takes two parameters (login, pw) and returns the user info. If I execute the SP manually, I get Session_UID User_Group_Name Sys_User_Name ------------------------------------ -------------------------------------------------- - NULL Administrators NTMSAdmin No rows affected. (1 row(s) returned) @RETURN_VALUE = 0 Finished running [dbo].[p_SYS_Login]. But with the code below, I only get the return value. do you know how to get the other values shown above like Session_UID, User_Group_Name, and Sys_User_Name ? if you see the commented part below code. I tried to add some output parameters but it doesn't work with incorrect number of parameters error. string strConnection = Settings.Default.ConnectionString; using (SqlConnection conn = new SqlConnection(strConnection)) { using (SqlCommand cmd = new SqlCommand()) { SqlDataReader rdr = null; cmd.Connection = conn; cmd.CommandText = "p_SYS_Login"; //cmd.CommandText = "p_sys_Select_User_Group"; cmd.CommandType = CommandType.StoredProcedure; SqlParameter paramReturnValue = new SqlParameter(); paramReturnValue.ParameterName = "@RETURN_VALUE"; paramReturnValue.SqlDbType = SqlDbType.Int; paramReturnValue.SourceColumn = null; paramReturnValue.Direction = ParameterDirection.ReturnValue; //SqlParameter paramGroupName = new SqlParameter("@User_Group_Name", SqlDbType.VarChar, 50); //paramGroupName.Direction = ParameterDirection.Output; //SqlParameter paramUserName = new SqlParameter("@Sys_User_Name", SqlDbType.VarChar, 50); //paramUserName.Direction = ParameterDirection.Output; cmd.Parameters.Add(paramReturnValue); //cmd.Parameters.Add(paramGroupName); //cmd.Parameters.Add(paramUserName); cmd.Parameters.AddWithValue("@Sys_Login", textUserID.Text); cmd.Parameters.AddWithValue("@Sys_Password", textPassword.Text); try { conn.Open(); object result = cmd.ExecuteNonQuery(); int returnValue = (int)cmd.Parameters["@RETURN_VALUE"].Value; if (returnValue == 0) { Hide(); Program.MapForm.Show(); } else if (returnValue == 1) { MessageBox.Show("The username or password you entered is incorrect", "NTMS Login", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (returnValue == 2) { MessageBox.Show("This account is disabled", "NTMS Login", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { MessageBox.Show("Database error. Please contact administrator", "NTMS Login", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { string message = ex.Message; string caption = "MAVIS Exception"; MessageBoxButtons buttons = MessageBoxButtons.OK; MessageBox.Show( message, caption, buttons, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); } } } Thanks for your help.

    Read the article

  • Complex MySQL table select/join with pre-condition

    - by Howard
    Hello, I have the schema below CREATE TABLE `vocabulary` ( `vid` int(10) unsigned NOT NULL auto_increment, `name` varchar(255), PRIMARY KEY vid (`vid`) ); CREATE TABLE `term` ( `tid` int(10) unsigned NOT NULL auto_increment, `vid` int(10) unsigned NOT NULL default '0', `name` varchar(255), PRIMARY KEY tid (`tid`) ); CREATE TABLE `article` ( `aid` int(10) unsigned NOT NULL auto_increment, `body` text, PRIMARY KEY aid (`aid`) ); CREATE TABLE `article_index` ( `nid` int(10) unsigned NOT NULL default '0', `tid` int(10) unsigned NOT NULL default '0' ) INSERT INTO `vocabulary` values (1, 'vocabulary 1'); INSERT INTO `vocabulary` values (2, 'vocabulary 2'); INSERT INTO `term` values (1, 1, 'term v1 t1'); INSERT INTO `term` values (2, 1, 'term v1 t2 '); INSERT INTO `term` values (3, 2, 'term v2 t3'); INSERT INTO `term` values (4, 2, 'term v2 t4'); INSERT INTO `term` values (5, 2, 'term v2 t5'); INSERT INTO `article` values (1, ""); INSERT INTO `article` values (2, ""); INSERT INTO `article` values (3, ""); INSERT INTO `article` values (4, ""); INSERT INTO `article` values (5, ""); INSERT INTO `article_index` values (1, 1); INSERT INTO `article_index` values (1, 3); INSERT INTO `article_index` values (2, 2); INSERT INTO `article_index` values (3, 1); INSERT INTO `article_index` values (3, 3); INSERT INTO `article_index` values (4, 3); INSERT INTO `article_index` values (5, 3); INSERT INTO `article_index` values (5, 4); Example. Select term of a defiend vocabulary (with non-zero article index), e.g. vid=2 select a.tid, count(*) as article_count from term t JOIN article_index a ON t.tid = a.tid where t.vid = 2 group by t.tid; +-----+---------------+ | tid | article_count | +-----+---------------+ | 3 | 4 | | 4 | 1 | +-----+------------ Question: Select terms a. of a defiend vocabulary (with non-zero article index, e.g. vid=1 = term {1,2}) b. given that those terms are linked with articles which are linked with terms under vid=2, e.g. = {1}, term with tid=2 is excluded since no linkage to terms under vid=2 SQL: Any idea? Expected result: +-----+---------------+ | tid | article_count | +-----+---------------+ | 1 | 2 | +-----+---------------+

    Read the article

  • Updating an integer defined column in a MySQL DB with PHP

    - by Zloy Smiertniy
    I have a table defined like this: create table users ( id int(10), age int(3), name varchar (50) ) I want to use a query to update just age, which is an integer, that comes from an html form. When it arrives to the method that updates it, it comes as a string, so I change it to integer with PHP and try to update the table, but it doesn't work $age = intval($age); $q2 = "UPDATE users SET age='$age' where username like '$username';"; mysql_query($q2,$con);

    Read the article

  • Creating temporary tables in MySQL Stored Procedure

    - by burntblark
    The following procedure gives me an error when I invoke it using the CALL statement: CREATE DEFINER=`user`@`localhost` PROCEDURE `emp_performance`(id VARCHAR(10)) BEGIN DROP TABLE IF EXISTS performance; CREATE TABLE performance AS SELECT time_in, time_out, day FROM attendance WHERE employee_id = id; END The error says "Unknown table 'performance' ". This is my first time actually using stored procedures and I got my sources from Google. I just cant figure out what I am doing wrong.

    Read the article

  • What is the best way of inserting a datetime value using dynamic sql

    - by jaffa
    What is the best way of inserting a datetime value using a dynamic sql string, whilst at the same time being able to handle the possibility of the value being null? The current statement inserts into a table from a select statement built using a string. The datetime value is stored in a parameter and the parameter is used in the select. Like so: set @execsql = 'Insert into ( start_date ) SELECT ( ''' + CAST(start_date as VARCHAR) + ''' + ')'

    Read the article

  • SQL 2008 CASE statement aggravation...

    - by Brad
    Why does this fail: DECLARE @DATE VARCHAR(50) = 'dasf' SELECT CASE WHEN ISDATE(@DATE) = 1 THEN CONVERT(date,@DATE) ELSE @DATE END Msg 241, Level 16, State 1, Line 2 Conversion failed when converting date and/or time from character string. Why is it trying to convert dasf to date when it clearly causes ISDATE(@DATE) = 1 to evaluate to false... If I do: SELECT ISDATE(@DATE) The return value is 0.

    Read the article

  • SQL:Casting a String to IDS with IN clause

    - by Shyju
    DECLARE @STR_IDS VARCHAR(15) SET @STR_IDS='7,15,18' UPDATE TBL_USERS WHERE ID IN @STR_IDS I know the update statement would not work as the ID is of type INT and i am replacing a varachar value there .How can i change the query so that it will be executed like this in effect ? UPDATE TBL_USERS WHERE ID IN (7,15,18) Thanks in advace

    Read the article

  • MySQL: SUM in WHERE clause

    - by checcco
    Hi guys, I've got this table CREATE TABLE `subevents` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(150) DEFAULT NULL, `content` text, `class` tinyint(4) NOT NULL DEFAULT '1', PRIMARY KEY (`id`) ) ENGINE=MyISAM Each row can have a different value in the 'class' field. I'd like to select any number of rows, ordered randomly, as long as the sum of the values in the 'class' field is equal to 100. How could I accomplish it directly in the MySQL query without doing it later in PHP? Thanks everybody!

    Read the article

  • Mysql dynamic query

    - by pradeep
    I have two table in mysql one tbl_a which has one int column id, second tbl_b which has one column song_ids in which data stored seapated by comma like 1,2,3,4 i want to select all id like this select * from tbl_a where id in (select song_id from tbl_b) but its giving me no record as its varchar HOW to do it in mysql

    Read the article

  • MySQL One to Many order by number found in joined table

    - by Finbarr
    Two tables: table_a ------- table_a_id: (primary, int) table_b ------- table_a_id: (index, int, from table_a) table_b_value: (varchar) A one to many relationship between table_a_id and table_b_value. Given a query like this: SELECT DISTINCT(table_a_id) FROM table_a JOIN table_b ON table_a.table_a_id=table_b.table_a_id I want to order by the number of occurrences of table_a_id in table_b. I'm not really sure how to write this in MySQL.

    Read the article

  • Concatenate a table name from a variable in a FROM clause

    - by idieeasy
    I'm trying to use a dynamically generated fully-qualified table name in sql server 2008. For example, this does not work: select max([id]) from @dbName+N'.[T1]' This will give an error like: Msg 102, Level 15, State 1, Line 73 Incorrect syntax near '+'. I know that something like this works: declare @qualifiedTable varchar(200) = @dbName+N'.[T1]' select max([id]) from @qualifiedTable But I have to do this LOTS of times so I would really like to do it in line. Is it possible?

    Read the article

  • joining two tables and getting aggregate data

    - by alex
    how do i write a query that returns aggregate sales data for California in the past x months. ----------------------- ----------------------- | order | | customer | |-----------------------| |-----------------------| | orderId int | | customerId int | | customerId int | | state varchar | | deposit decimal | ----------------------- | orderDate date | ----------------------- ----------------------- | orderItem | |-----------------------| | orderId int | | itemId int | | qty int | | lineTotal decimal | | itemPrice decimal | -----------------------

    Read the article

  • Update XML as Upper Case in SQL Server

    - by monO
    I store an XML string in a column in my SQL Server database. I'm trying to run an UPDATE statement that will make a certain field into Upper Case. I can do that easily during a SELECT but can't get it to work with an update. This SELECT statement works select Upper(XmlTest.value('(/CodeFiveReport/Owner/@UnitNumber)[1]', 'varchar(10)')) as UnitNumber from uploadreport But I want to update it the XML as that permanently Update table Set XmlString.Modify('replace value of (/Root/Node/@Field)[1] with ?

    Read the article

  • PHP MYSQL SIMPLE SEARCH ISSUE

    - by Kunal
    Hi I have a table with the following structure: id int(11), name varchar(250) I have lots of records in the table but when I am trying to find a particluar record which has the following value on the name field: Lorem ipsum d\'olor sit amet The query is simply returning a blank recordset. I am not being able to figure out this weird behaviour, when my query is as simple as follows: SELECT * FROM slot_games WHERE name='Lorem ipsum d\'olor sit amet' Would appreciate your help please! Thanks in advance.

    Read the article

< Previous Page | 44 45 46 47 48 49 50 51 52 53 54 55  | Next Page >