I have two tables A and B where there is one-to-many relationship.
Now I want some records from A and with this existence field that shows if B has any matching records. I don't want to use the count function as B has too many records that delays SQL execution. Either I don't want to use proprietary keywords like rownum of Oracle like b...
I'm interested in T-SQL source code for synchronizing a table (or perhaps a subset of it) with data from another similar table. The two tables could contain any variables, for example I could have
base table source table
========== ============
id val id val
---------- ------------
0 1 0 3
...
How to retrieve data from two tables whose column names are the same?
...
I've heard it claimed that the simplest solution to preventing SQL injection attacks is to html encode all text before inserting into the database. Then, obviously, decode all text when extracting it. The idea being that if the text only contains ampersands, semi-colons and alphanumerics then you can't do anything malicious.
While I s...
Good day!
My new hosting provider doen't support restoring MS SQL backups with full-text indexes\catalogs inside.
I can't found any way to create a backup without full-text capabilities inside. One way is to drop fulltext catalog and indexes, do a backup and then revert changes back, but if there any better way?
Thanks in advance!
...
I have two models:
class User
end
class Message
belongs_to :sender, :class_name=> 'User'
belongs_to :recipient, :class_name=> 'User'
end
I want to fetch all the buddies of a given user ordered by most recent date of message what appears in conversation between given user and his buddy and, if it possible in same query, to fetch the...
I do not not know much about Regex, I want to try parsing sting from database according to flowing instructions.
I know that I am need to use CLR but for begin I want to learn Regex
Data in tables look like
create table #tempTBL (opis varchar(40))
go
insert into #tempTBL
select 'C 136'
union
select 'C 145'
union
select 'C146'
union ...
I have a table (user) that contains user information.
I have another table (userview) that records user views - that is, when one user views another users details, I record the id of the viewer and also, the id of the user he/she viewed.
I want to write a query that will help me answer the question:
Fetch the list of ALL users that we...
Hi I am working on a Vb.Net application . I have a compose message web form where users will compose a message , but after the users click the send button I am inserting in the message table. All is working fine , infact great . Now I am thinking of adding a undo button where I will show this button if the user will click the send button...
Hello
I have a database that is on a SQL 2000 server, and I would like to make it a Sql 2005 express edition database.
What is needed to do in order to make that work?
/M
...
When I create a view I can base it on multiple columns from different tables.
When I want to create a lookup table I need information from one table, for example the foreign key of an order table, to get customer details from another table. I can create a view having parameters to make sure it will get all data that I need. I could also...
Hi, I'm a bit of a NHibernate newbie and Im taking on some code written by another developer. I want to find out how NHibernate converts lambda based criteria into SQL.
I know in Linq to SQL using Lambda expressions on queries means that the whole thing is turned into an expression tree and then into SQL (where possible) by the Linq to ...
I have a very simple query that's giving me unexpected results. Hints on where to troubleshoot it would be welcome.
Simplified, the query is:
SELECT Obs.obsDate,
Obs.obsValue,
ObsHead.name
FROM ml.Obs Obs
JOIN ml.ObsHead ObsHead ON ObsHead.hdId = Obs.hdId
WHERE obs.hdId IN (53, 54)
This gives me a query cost of:...
I'm working with a programmer who doesn't want me touching his database...
I would like work with a database instead of hard coding my content but don't want the sites performance to suffer.
Is it bad practice to query two different databases on one page?
If its not a problem is there a limit to how many databases you can query per pa...
I have never seen this before, the rows will be sequential but I have noticed that it skipped over a particular "ID".... 1 2 3 4 6 7 8... missing 5...
There are no transactions in the INSERT stored procedure so nothing to roll back
We do not allow the deletion of records.
What else can be the case?
...
I have the following linq query (applied to the Northwind database)
(from od in OrderDetails
where od.ProductID == 11 || od.ProductID == 42
select od.OrderID).Distinct()
Which gives me a list of Order Ids (67 items) where the order includes either product 11 or 42. How can I rewrite the query to give me a list of Order Ids where the o...
How to aggregate string( concatenate) with Oracle 10g SQL?
...
Table_Design:
ID
"Alpha"
"Beta"
Table_Size:
Design_ID Size
"Alpha" S
"Alpha" M
"Alpha" L
"Beta" S
"Beta" L
Table_Color:
Design_Id Color
"Alpha" "Black"
"Alpha" "Blue"
"Alpha" "Red"
"Alpha" "Green"
"Beta" "Orange"
select D.ID, S.Size, C.Color from
Table_Design D
Left Outer Join
Table_...
I have a table with about 1 billion rows. I'm the sole user so there's no contention on locks, etc.
I noticed that when I run something like this:
DECLARE
CURSOR cur IS SELECT col FROM table where rownum < N;
BEGIN
OPEN cur;
LOOP
dbms_output.put_line("blah")
END LOOP;
CLOSE cur;
END;
there is a lag between the time ...
Hey guys.
I need to write a query on SQL server to get the list of columns in a particular table, its associated data types and their length and if they are not null. I have managed to do this much. But now i also need to get in the same table against a column - TRUE if it is a primary key. How do i do this ?
This is how the output s...