The current structure is as follows:
Table RowType: RowTypeID
Table RowSubType: RowSubTypeID
FK_RowTypeID
Table ColumnDef: FK_RowTypeID
FK_RowSubTypeID (nullable)
In short, I'm mapping column definitions to rows. In some cases, those rows have subtype(s), which will have column definitions sp...
I wrote the following query, I think it's correct but I have a "missing operator" error.
SELECT * FROM results,Types WHERE results.a=Types.b
INTERSECT SELECT * FROM results,Types WHERE results.c=Types.b
Could somebody help me please?
Thanks a lot.
...
I have a stored procedure that needs to return something from one of two databases:
IF @x = 1
SELECT y FROM Table_A
ELSE IF @x = 2
SELECT y FROM Table_B
Either SELECT alone will return what I want, but adding the IF/ELSE makes it stop returning anything. I tried:
IF @x = 1
RETURN SELECT y FROM Table_A
ELSE IF @x = 2
R...
I am wondering if it is possible to take the results of a query and return them as a CSV string instead of as a column of cells.
Basically, we have a table called Customers, and we have a table called CustomerTypeLines, and each Customer can have multiple CustomerTypeLines.
When I run a query against it, I run into problems when I want ...
In my database, assume we have a table defined as follows:
CREATE TABLE [Chemical](
[ChemicalId] int NOT NULL IDENTITY(1,1) PRIMARY KEY,
[Name] nvarchar(max) NOT NULL,
[Description] nvarchar(max) NULL
)
The value for Name can be very large, so we must use nvarchar(max). Unfortunately, we want to create an index on this col...
Hi there, I have a dedicated server which hosts a Windows Service which does a lot of very heavy load stuff and populates a number of SQL Server database tables.
However, of all the database tables it populates and works with, I want only one to be synchronised with a remote SQL Azure DB table. This is because this table holds what I c...
I have Sql query:
SELECT News.NewsId, News.Subject, Cm.Cnt FROM dbo.News
LEFT JOIN
(SELECT Comments.OwnerId, COUNT(Comments.OwnerId) as Cnt
FROM Comments
WHERE Comments.CommentType = 'News'
Group By Comments.OwnerId) Cm
ON Cm.OwnerId = News.NewsId
But I want linq-to-sql query, how I can convert this to linq?
...
PROBLEM
Hello,
I am having no luck trying to break down this SQL statement into ActiveRecord/Rails friendly code and I'd like to learn how I can avoid a find_by_sql statement in this situation.
Scenario
I have users that create audits when they perform an action. Each audit is of a specific audit_activity. Each audit_activity is wort...
I have a table with columns named with the number of hour of day like this:
col00 NUMBER(5)
col01 NUMBER(5)
col02 NUMBER(5)
...
col23 NUMBER(5)
...and I have another query that returns a count by hour.
I want to recover the colXX value by hour.... then I can recover with "decode" or "case when..." but I want know if exists any way to...
i am doing:
explain select * from calibration;
it says 52133456345632 rows
when i do:
select count(*) from calibration;
i am getting 52134563456961
can someone explain whats going on here?
...
i am adding data from vba excel using adodb into a mysql database
everything works great but is slow. the entire process takes about 5 seconds.
i believe the reason it is slow is because i am filtering it:
Dim rowid_batchinfo As String
rs.Filter = "datapath='" + dpath + "' and analystname='" + aname + "' and reportname='" + rname + "'...
Hi,
What would be the equivalent Excel formula of this SQL query
SELECT SUM(a) FROM table WHERE b < 0;
A B
---- ----
1 0
2 -1
3 4
5 -3
>> 7
...
i asked the question of whether an index would help me:
http://stackoverflow.com/questions/2961834/should-i-be-creating-an-index-for-this
i understand that since i am adding code every time in this procedure, i would need to re-index. in this case is it even worth it to index every time?
...
in mysql i have 3 tables. one is 500,000, another 300,000, and finally around 5,000
they each get maybe 50-500 additional rows daily
should i run analyze and optimize table on them? if so then how often?
...
I'm storing some very basic information "data sources" coming into my application. These data sources can be in the form of a document (e.g. PDF, etc.), audio (e.g. MP3, etc.) or video (e.g. AVI, etc.). Say, for example, I am only interested in the filename of the data source. Thus, I have the following table:
DataSource
Id (PK)
Filenam...
I want to do something like:
lastName SIMILARTO(lastName, 'Schwarseneger', 2)
where lastName is the field in the database, 'Schwarseneger' is the value that lastName field is being compared to and 2 is the maximum number of characters (edit distance) that can differ between the lastName field, and the entered value.
I can implement the...
Hi:
What would be the insert SQL statement to merge data from two tables. For example I have events_source_1 table (columns: event_type_id, event_date) and events_source_2 table (same columns) and events_target table (columns: event_type_id, past_event_date nullalbe, future_event_date nullable).
Events_source_1 has past events, Events...
I recently migrated a database from sql server 2005 to 2008 on windows server 2008. Clients connect fine from their XP machines and so does the SQL Management Studio 2008. I have also tested a remote connection using LINQPad which worked fine.
However on my VB6 app, the connection string seems to give me problems. Any ideas what I'...
I'm attempting to create an anti-bruteforcer for the login page on a website. Unfortunately, my query is not working as expected. I would like to test how many times an IP address has attempted to login, and also return the ID of the user for my next step in the login process.
However, I'm having a problem with the query... for one thi...
How can I filter my results in a Query? example
I have 5 Records
John,Smith,apple
Jane,Doe,apple
Fred,James,apple
Bill,evans,orange
Willma,Jones,grape
Now I want a query that would bring me back 3 records with the DISTINCT FRUIT, BUT... and here is the tricky part, I still want the columns for First Name , Last Name. PS ...