I have some problems with writing a SQL query for MySQL. I have a table with the following structure: mysql> select id, pass, val from data_r1 limit 10; +————+————–+—————…
Tag: sql
SQL Server: backup all databases
I was wondering if there was any way of making a backup of an entire SQL Server (we are using SQL Server 2008) at regular intervals to a specific location. I know we are able to backup single specific databases but for ease of use and not having to set up a backup each time I want a new database,
NonUniqueDiscoveredSqlAliasException when two table has same column names
I have two tables Item and Nikasa – whose definitions looks like: Item { id, name, spec} and Nikasa {id, date, item_id}. Here item_id represents Item.id. I did a simple native SQL join to select only Item.id and Nikasa.id as: But I am getting exception NonUniqueDiscoveredSqlAliasException : Encountered …
How do I query for all dates greater than a certain date in SQL Server?
I’m trying: A.Date looks like: 2010-03-04 00:00:00.000 However, this is not working. Can anyone provide a reference for why? Answer In your query, 2010-4-01 is treated as a mathematical expression, so in essence it read (2010 minus 4 minus 1 is 2005 Converting it to a proper datetime, and using single q…
Alter SQL table – allow NULL column value
Initially, the table “MyTable” has been defined in the following way: CREATE TABLE IF NOT EXISTS `MyTable` ( `Col1` smallint(6) NOT NULL AUTO_INCREMENT, `Col2` smallint(6) DEFAULT NULL, `Col3` …
Undefined index uid calling GET fetch
I have a function that calls a SQL query, the function is type fetch_user Now i get an Undefined Index error when I call my query, The error message is Undefined index: uid in profile.php on line 3 But the thing is that i cant find the error, This is my user.inc.php that have the function And this is my
Need help converting date in format 20120130 to Date data type oracle sql
Could you please help me in converting date from the format “20120101” to DATE format in Orcle Sql. I looked at this link but it does not mention if the date format is custom.. EDIT: Is it possible …
How to get Database Name from Connection String using SqlConnectionStringBuilder
I do not want to split connection strings using string manipulation functions to get Server, Database, Username, and Password. I read the following link and read the accepted answer, I found that is the best way to get username and password out from connection string, but what about Database Name? Right way t…
Formatting column in SQL
I would like to insert the pipe character | in a column to separate two sections of the output. Is there a way to put one in every row of a column as long as there is data in that row? Answer
Why am I getting an error in this create table script? [closed]
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the …