In my stored procedure I am passing a filter (using "WHERE Column IN" clause) as a parameter. The value of the parameter is given as CSV. What is the best method to convert this CSV in to a record set.
Example:-
SELECT *
FROM Employee
WHERE Name IN ('John','Joe','Jerry','James')
and I need to pass the names as a parameter whi...
Two simple tables:
T1
ContactId,
Name,
Department
T2
AddressId
OwnerId
Address
Added
What I need to output is:
ContactId, Name, Department, Address however I only want one record per cusomer, the oldest based on Added (datetime).
Is this possible?
...
Would you please let me know a reference document or web references for a good E-R diagram displaying Parent Child relationships between the tables (Min. of 8 tables) with MS SQL Server 2008 database?
I am planning to design a big database, so looking forward for your help.
...
I've just wrapped a complex SQL Statement in a Table-valued function on SQLServer 2000.
When looking at the Query Plan for a SELECT * FROM dbo.NewFunc it just gives me a Table Scan of the table I have created.
I'm guessing that this is because table is created in tempdb and I am just selecting from it.
So the query is simply :
SEL...
I have recently started to look at sql reporting services.
I have data stored in a database which has been encrypted with an AES cypher before being stored away.
I've had a look at building some reports using Microsoft Report Builder 2.0 and it seems quite nice and simple for knocking together some simple reports.
My question is: Ca...
I was wondering if there is a more efficient way of doing an insert in MySQL against multiple tables than a separate insert query for each record in each table. I was thinking of doing something like this:
INSERT INTO table1
(t1c1, t1c2, t1c3), table2 (t2c1, t2c2, t2c3)
VALUES
('t1c1', 't1c2', 't1c3', 't2c1', 't2c2', 't2c3');
T...
I'm looking to see if I can get the results I need with a single query, and my MySQL skills are still in their adolescence over here.
I have 4 tables: shows, artists, venues and tours. A simplified version of my main query right now looks like this:
SELECT *
FROM artists AS a,
venues AS v,
shows AS s
LEFT J...
I'm currently trying to write a SQL Server 2005 function, which gets a string as parameter and creates a table with decimal values out of it.
The problem is, that I have to define the decimal type based on parameters. This not working snippet should demonstrate the idea:
CREATE FUNCTION [dbo].[ufn_ParseDecimal]
(
@Sequence VARCHAR...
Are there any built in functions for SQL where I can pass in a number and it returns a Letter that matches the number. Example, I supply a 6 and it returns a "F"
I realize its an incredibly long shot, just don't wanna re-invent the wheel
...
I do have this final query (I've tried a lot of them to make this work), which i'm not able to get it run.
SELECT customerNo, rating, dateApproved
FROM ['worksheet$']
WHERE dateCreated = (SELECT MAX(dateCreated) FROM ['worksheet$'] )
AND status = 'Approved'"
For a customerNo 0001 there are two or maybe more rows, and I want to ge...
I've written this code in order to fetch all the records in a table; however for some reason it's not working:
function GetAllData(){
$result = mysql_query("SELECT * FROM a2h_member_type");
while($row = mysql_fetch_array($result))
{
echo $row['member_type_id'] . " " . $row['member_type_name'] . " " . $row['descripti...
I am completely new to Microsoft Query.
I have the following tables defined:
FLEET_MASTERS Table
- REG_NO
- FMS_ID
ODOMETERS Table
- ODO_ID
- FMS_ID
ODOMETERS_READING Table
- ODO_ID
- ODO_READING
- ODO_READING_DATE
- ODO_READING_TYPE
I need these information:
REG_NO, ODO_READING, max(...
For a language course I need to record many sentences and words separately.
Ideally I would click on a button next to the written sentence in my database (e.g. MS Access or MySQL) and record the sentence. Then go to the next sentence.
Is there a way to do it that simple?
Until now, I record the sentence one by one in audio software l...
I have been asked to keep track of how many times each item comes up within the results of a particular query. My thought is to just store the result of a query into a tracking table and then spit the results back to the caller. I am wondering what the most efficient method of storing these results would be since the result set could i...
Hello all,
i search for a dynamic linq-to-sql Contains (StartsWith / EndsWith) method.
I’ve tried the following code, but it didn't work.
Any ideas?
public static IQueryable<T> WhereContains<T, V>(this IQueryable<T> queryable, string propertyName, V propertyValue)
{
ParameterExpression pe = Expression.Parameter(typeof(T), "p");
...
I am using Oracle.DataAccess.Client inside Powershell. What I need to do is INSERT a new row of data, then retrieve the auto-generated ID field of the newly-created row for another INSERT command, immediately following. What is the best way to do this? I am pretty new to SQL and Oracle. Here is some of my code:
$conn = "My Connection St...
Hi.
Would really appreciate some help with a search angine I'm trying to make for a karaoke music site using ASP.NET and SQL SERVER...
I have a table called Discs which has the following fields:
ID, DiscCode, DiscTitle, DiscType,
Theme, Manufacturer
There is also a table called Tracks with the following fields
ID, DiscID, A...
i have one simple table with following columns: id, name and parentID
i created relationship diagram between id and parentID (on a same table), like simple tree, on the same table, but when i tried to user cascade delete it was disabled for me
i know that it will be recursive delete if i will delete parent it will delete his children
...
Given the folowing mysql table:
ID|name|year|month|day
----------------------
1 |john|1978|5|1
2 |mike|1979|7|23
3 |bob |1985|2|14
4 |joe |1964|2|16
5 |jane|1975|9|22
I'm trying to extract the users in order of their birthday events, upcoming birthdays first.
So, if the query is executed on September 16, the order should be: j...
I turned snapshot isolation on in my database using the following code
ALTER DATABASE MyDatabase
SET ALLOW_SNAPSHOT_ISOLATION ON
ALTER DATABASE MyDatabase
SET READ_COMMITTED_SNAPSHOT ON
and got rid off lots of deadlocks.
But my database still produces deadlocks, when I need to run a script every hour to clean up 100,000+ rows.
Is...