Hi
I have a field with the following content in a record in my SQL Server database:
salsaaften
It means "salsa evening" in danish for those interested :)
When I do like this I am not able to find the record:
SELECT * FROM table_name WHERE field_name LIKE '%salsa%'
However, when I do this, I find the record perfectly fi...
Here is the scenario:
I have run a trace for few hours during maximum server load using the three events (never mind this) that DTA looks for. I then stop and feed this profiler load to DTA. It does its tuning work and gives me feedback on what indexes need to be put.
Here is the question:
Several (upto 15) different indexes recomme...
Right now the query below is retrieving more then one product record. How can I limit the results set to only retrieving the one record per product_ID? Multiple records will be returned from different products, but I only need one product line per product_id. This is MS SQL 2005
SELECT DISTINCT dbo.Products.Product_ID AS Expr1,
...
This is a WinForms application.
There is a many-to-many relationship between the rows in TABLEA and TABLEB. There is a record in TABLELINK for every row in TABLEA that is related to a row in TABLEB. Think "users" and "roles" or something similar, with each TABLELINK record indicating "user X has role Y."
I'm browsing through TABLEA rec...
Hi folks.Thank u a lot for your answers beforehand. I need to make a such thing
I have a table friendship (id,user_id,friend_id,status,timestamp)
So lets say I am a user with user_id=43 and I am visiting a user with user_id=15
In the profile it should be a connection line of friendships
Let me describe ... lets say I have...
Group, I am going to try and explain this as best I can, and I hope it makes (some) sense. I am pulling data from a view I have created that tells me a "Sponsor's" customer types and how many of those accounts by CustomerType are inactive after 1 year, 2 years and 3 years. For example:
SponsorID | CustomerType | ExpiredAfter | Total
1...
ive got a really weird problem. i have no clue why its not working. i create an user and get the id and insert a row based on that id in another table. the row gets inserted with that id but the other values however for that row are not inserted!
$user_id = mysqli_insert_id($this->connection);
$query = "INSERT INTO selections
(user...
My application will need to reference addresses. Street info will be stored with my main objects but the rest needs to be stored seperately to reduce redundancy. How should I store/retrieve ZIPs, cities and states? Here are some of my ideas.
single table solution (cant do relationships)
[locations]
locationID
locationParent (FK for loc...
When running a SQL query with output to text we typically get back output like this.
AssetID Occurs
-------------------- -----------
(0 row(s) affected)
Since I am doing thousands of select statements to audit data in my table is there a way to suppress this output on SQL server?
...
I have designed databases several times in my company. To increase the performance of the database, I look for Normalisation and Indexing only.
If you were asked to increase the performance of a database which has approx 250 tables and some tables with millions of records, what different things you would look for?
Thanks in advance.
...
I have two table
Book (BookID, BookName)
Issue (BookID, IssueDate, Qty)
So, how can i find the maximum "issued book name" for a specified date.
...
I have a database for a Train company. I want to combine two queries together so I can use them as one from a Java front end.
The first query returns the IDs of trains that are not full.
select TrainID
from Train
where Capacity > 0;
Each train has a capacity of 50 and I subtract one each time a seat is booked, so if the capacity...
I would like to run my UPDATE statement on my table and see what the results will be without actually changing the table.
For example:
UPDATE MyTable SET field1=TRIM(field1);
I would like to see the result of that without actually changing the tables content. Is this possible?
Specifically I am asking about MySQL.
Also, I know I ...
Using SQL2k5, I have a staging table that contains columns that will populate numerous other tables. For instance, a statement like this:
INSERT INTO [appTable1] ([colA], [colB])
SELECT [appTable1_colA], [appTable1_colB]
FROM [stageTable]
A trigger on [appTable1] will then populate the identity column values of the newly inserted ...
I've got a query like the one below:
Select ser.key
From dbo.Enrlmt ser
Where ser.wd >= @FromDate AND ser.wd <= @ThrouDate AND
ser.EnrlmtStatCode = '4321' AND
ser.StuExitCatgCode in ('1','2','3','4','5','6','7') AND
ser.Key not in (select Key
from Enrlmt ser2
...
I have an old table with a few rows that has a datetime column. I want to switch this to datetimeoffset but i want to be able to transfer the data that already exists. So i'm doing something like [1]. This works but the offset set is 0 when i do the dattime to datetimeoffset assignment. Fortunately the offset that i want to set it to i...
Hello,
I have two tables Activity and Action. One or more actions can be performed for an activity. And the relationships between Activity and Action is given in a third table called Activity Action.
How do I retrieve a result set that tells me what action is applicable for each activity using an sql statement? Here's the table structu...
I'm working with some rather sensitive data, so I want to be ABSOLUTELY sure I am doing it properly.
I am trying to delete the rows in a table that are associated with another table
The only way to associate the table is to join through two other tables...
here is the exact query:
DELETE tt.Transaction_Amount, tt.Transaction_ID
FRO...
OK I have this query which gives me DISTINCT product_series, plus all the other fields in the table:
SELECT pi.*
FROM (
SELECT DISTINCT product_series
FROM cart_product
) pd
JOIN cart_product pi
ON pi.product_id =
(
SELECT product_id
FROM cart_product po
WHER...
Edit: using SQL Server 2005.
I have a query that has to check whether rows from a legacy database have already been imported into a new database and imports them if they are not already there. Since the legacy database was badly designed, there is no unique id for the rows from the legacy table so I have to use heuristics to decide wh...