I recently asked a colleague why they had included _TABLE at the end of all their database table names. They said it had been a standard at another orgainisation they had worked for. Other colleagues use V_ at the start of views.
Is this good practice?
...
I have a single table containing many users. In that table I have column called user_id (INT), which I want increment separately for each person. user_id MUST start at 1
I've prepared a simple example:
Showing all names
+--------------+-----------------------+
| user_id | name |
+--------------+-------------------...
HI,
Using: SQL Server
Database: Northwind
I'd like to drop a table primary key, without knowing the PK constraint name..
eg, using the Categories table in the Northwind Sample database, the primary key column is 'CategoryId', and the primary key name is 'PK_Categories'
I can drop the primary key while knowing the primary key name:
A...
I am able to retrieve data from the same database table but am not able to isert
The error which i get is
DB2 SQL error: SQLCODE: -516, SQLSTATE: 26501, SQLERRMC: null
...
Hi,
We have more than 1 instances of a certain exe running from different locations. An exe is supposed to fetch a set of records and do some work based on them. The set of records fetched from exe A should not be fetched by exe B and vice versa. Exes A & B are the same exes; they are running from different locations. The number of inst...
I'm connected to an OpenEdge DataServer via ODBC (not our product, we are just accessing their database, I hardly have any information and certainly no help from the other side).
Anyhow, I just need to execute a simple Select, add a couple of rows and I need the equivalent of an IsNull statement.
Basically I'd like to execute
SELECT I...
What is the better way to synchronize a table (customers), inside SQL Server and the curtomers inside an CSV file in Microsoft Excel?
Ok, here is the explanation:
I am developing a software in C#.NET 2008, and I create a table named Customers in SQL Server 2005. The contents of this table comes from a csv file and the user can add more ...
Hey, I am using iBATIS with SQL Server Compact Edition 3.5 and try to do a subselect
INSERT INTO FORMINSTANCE (ID, ID_FORM)
SELECT #ID#, f.ID
FROM FORM f
WHERE ID_PROCESS='10804'
When I commit the transaction I get an SqlCeException (SSCE_M_QP_PARAMETERNOTALLOWED).
That the Symbol '@' is on the wrong place. I think this is ...
I have a hash which has in excess of a thousand key/value pairs.
I have a database table with several thousand rows.
So to brute-force an update of the table based on the hash is pretty simple. e.g. :
my_hash.each{|key,value|
Model.update_all("column2 = #{value}", "column1 = #{key}")
}
But this will do over a thousand SQL update ...
So I'm working on a CMS that will allow users to "traverse" through database tables. I'm having some trouble implementing it though, and am wondering if anyone has any suggestions.
Table: house
name (varchar), town (relationship, using the rel table)
Table: town
name(varchar), state (relationship, using the rel table)
Table: state
na...
i fail while converting this sql to linq...
hope anybody do it.
SELECT Max([PersonalNumber]+1)
FROM TestTable
GROUP BY CalYear
HAVING CalYear=Year(Now())
Thanks.
...
In a table in my datatase I have a datatime column which stores the time at which the record is added. How can I delete all records which are older than a day when I run a stored procedure (considering the current time) ?
...
Is it possible to shorten a group by clause so that you do not have to repeat the fields mentioned in the select clause ad nauseam? For example:
SELECT
field1,
field2,
field3,
field4
FROM table
GROUP BY
field1,
field2,
field3,
field4
to:
SELECT
field1,
field2,
field3,
field4
FROM table
GROUP BY
SELECT.*
...
I have a SQL database (sdf file)
I would like to create dummy records to fill in the database for a fixed size of say 22 MBytes.
I have a simple insert command:
INSERT INTO Log
(Time, Source, MyID, SubID, Description)
VALUES ('2009-09-17 01:20:35', '1', '1', '60', 'Test Record')
What I need to do is be able to create a...
I discovered(*) today that, depending on the server, my TSQL commands were case-sensitive, meaning that, when one table's column is named tableId, the following instruction might not succeed:
SELECT TableId FROM myTable
Depending on the column's collation. SQL_Latin1_blablabla seems not to be case-sensitive, when Latin1_blablabla is.
...
I want to extract data from database where field "end_ date" is less than today's date and where end_date is not equal to null; how would I do that? I figured the second part out .. I have trouble with first part
select *
from table
where to_char(end_date) IS NOT null
...
I have 2 queries in MS SQL that return a number of results using the COUNT function.
I can run the the first query and get the first result and then run the other one to get the other result, subtract them and find the results; however is there a way to combine all 3 functions and get 1 overall result
As in: run sql1 run sql2 run SQL3...
Here's my scenario:
Let's say I have a stored procedure in which I need to call another stored procedure on a set of specific ids; is there a way to do this?
i.e. instead of needing to do this:
exec p_MyInnerProcedure 4
exec p_MyInnerProcedure 7
exec p_MyInnerProcedure 12
exec p_MyInnerProcedure 22
exec p_MyInnerProcedure 19
Doing s...
How can I replace single-quote (') with double-quote (") in sql query - oracle 10g?
...
Hello,
i know how to delete my tables in MySQL,
DROP TABLE
but now i need to know how to delete my tables who all have the prefix
myprefix_
How to?
--I NEED TO DO THIS IN PHPMYADMIN, IN A BROWSER. NO TERMINAL STUFF PLEASE. BATCH STUFF IS ALWAYS APRECIATED.--
...