I'm looking to refactor the below query to something more readable and modifiable. The first half is identical to the second, with the exception of the database queried from (table names are the same though.)
SELECT
Column 1 AS c1,
...
Column N AS cN
FROM
database1.dbo.Table1
UNION
SELECT
'Some String' as c1...
What is the database concept equivalent to "when deleting the user, delete all his posts"?
And is this a good thing?
Another example: if your website is a programming forum, you need to find and delete comments related to that topic before deleting the topic.
Should this be handled automatically in the database layer?
...
If you had a DBA who was responsible for deploying databases in a live environment, what would you choose to give him? A database creation script or a backup which he could restore onto an existing database? What kinds of advantages/disadvantages are there? (We're using MSSQL2000 and MSSQL2005)
...
I know it's not supported, and I know it's not even a terribly good idea. But, I want to have a WCF client inside a SQL Table Valued Function.
I've (seemingly) registered the correct assemblies, but when running my client - I get a WCF error:
Msg 6522, Level 16, State 1, Line 1
System.ServiceModel.CommunicationObjectFaultedException: ...
I'm writing a new Windows Forms 2.0 application. This application is going to have a data file. The user will be able to open the data file, do some work and save it to disk. Then he'll be able to open it later, to continue working. Same thing as Microsoft Word and .doc files.
I'd like to use SQLite for the data file. However, I don't w...
I have a column of numbers stored as chars. When I do a ORDER BY for this column I get the following:
100
131
200
21
30
31000
etc.
How can I order these chars numerically? Do I need to convert something or is there already an SQL command or function for this?
Thank You.
...
I need to query this DB to get each row, but also the SUM of one of the column values of the results. I could use php to get the total value, but then I'd need to run two loops, one to get the total (which goes at the top above the results). So I'd prefer the query to catch it and just make a "total" row, but the only way I've gotten it ...
You have one table against which you wish to count the number of items in two different tables. In this example I used buildings, men and women
DROP TABLE IF EXISTS building;
DROP TABLE IF EXISTS men;
DROP TABLE IF EXISTS women;
CREATE TABLE building(name VARCHAR(255));
CREATE TABLE men(building VARCHAR(255), name VARCHAR(255));
CREATE ...
I am trying to prepare an ERD. There are three entities population, GeographicRegion, and inidividuals.
looking for some suggestions for attributes for them?
Some I have: Individuals: race, gender, name
Population: size, race
GeographicRegions: region, temp
any other suggestions?
...
In the final stage of development I started looking at code to try to find some bad practices. I discovered that while accessing a page, I'm querying the DB n times (n is the number of rows of an HTML table) just to get the translation (different languages) for a given record... I immediately thought that was bad and I tried a small opti...
I have a table with about 2,000,000 rows. I need to query one of the columns to retrieve the rows where a string exsists as part of the value.
When I run the query I will know the position of the string, but not before hand. So a view which takes a substring is not an option.
As far as I can see I have three options
using like ‘% %’...
Given this linq query against an EF data context:
var customers = data.Customers.Where(c => c.EmailDomain.StartsWith(term))
You’d expect it to produce SQL like this, right?
SELECT {cols} FROM Customers WHERE EmailDomain LIKE @term+’%’
Well, actually, it does something like this:
SELECT {cols} FROM Customer WHERE ((CAST(CHARINDEX(@...
The most relevant google result seems to indicate that in order to access the logs we have to depoly our own log tables to the database and make Reporting Services write to it.
Simply put: surely there must be plain text log files for Reporting Services? If yes, where are these files stored?
...
EDIT: Duplicate of http://stackoverflow.com/questions/94906/how-do-i-return-random-numbers-as-a-column-in-sql-server-2005
Hello
How can I generate random numbers in mssql server 2005.
for example: when I select 500rows from table, each row must have one generated random number, numbers must be generated at runtime
UPDATE: I need the ...
I am using nested repeaters to build a table for reasons I won't discuss here, but what I'm looking to do is have two datasources, one for the top level repeater that will correspond to the rows, and one for the second level repeater that will return cells within a row.
What I'm wondering, however, is if I can somehow specify a paramete...
If I have data like this in a table
id data
-- ----
1 1
1 2
1 3
2 4
2 5
3 6
3 4
how do I get results like this in a query (on sybase server)?
id data
-- ----
1 1, 2, 3
2 4, 5
3 6, 4
...
I have an HSQLDB database with a generated ID and I want the auto-incrementing values to always be above 100,000. Is this possible with HSQLDB? Is this possible with any database?
...
Is it possible in hibernate to have an entity where some IDs are assigned and some are generated?
For instance:
Some objects have an ID between 1-10000 that are generated outside of the database; while some entities come in with no ID and need an ID generated by the database.
...
Imagine the following table:
-------------------------------------------------------------
ID | XML
-------------------------------------------------------------
1 | <Form><object ID="1" /></Form>
2 | <Form><object ID="2" /></Form>
3 | <Form><object ID="2" /></Form>
---------------------------------------------...
This question is complicated so examples would work best...I have the following table on ODBC, not SQL server Management
NAME SEQNUM
JOHN 2
JOHN 4
JOHN 7
MARY 12
MIKE 4
MIKE 9
PETER 7
PETER 12
So, i want to pull back one name with the lowest seqNum...
NAME SEQNUM
JOHN 2
MARY ...