I have a Stored Procedure that returns three record sets. Here it is being called in Studio.
EXEC CampaignData '007CF7F8-AE8D-DE11-8BBA-0003FF4C13C9'
I can't cut and paste the record sets from Management Studio but trust me it shows three record sets, first one has one row with 2 values, the second has three rows and the third has 2 r...
I tried hard but couldn't got the answer
...
declare @top int
set @top = 5
select top @top * from tablename
Is it possible?
Or any idea for such a logic (i don't want to use dynamic query)?
...
Please see data given below
I want to keep one set of records and want to delete another duplicate set of records. You can see ForeignKey are same just Primary Key is different.
Need to keep 2 records having lowest primary key among the set of 4 records.
...
I need to get the value returned from a stored procedure in my Sql Server db.a This store procedure using a return statement to return a value back to the app.
I need to retrieve this value in C#. How do i get this value?
Note:
I know i can use ExecuteScalar while using "select ..." in the sp to retrieve this value.
I also know i can...
Using SQL Server 2008 I created a Stored Procedure called MyStoreProc and it runs fine from the Management Tools.
In VB.Net 2008 I created a new dataset and a new TableAdaptor. In this table adapter I created a new Query called FillByGrid and selected the Stored Procedure. Previewed data and it previewed correctly.
On a form I create...
Currently this query:
SELECT InvoiceNumber, CustomerCode, Amount, InvoiceDate
FROM Invoice
Returns:
aaa, 111, 5, 07/12/2009
bbb, 111, 5, 07/11/2009
ccc, 222, 5, 07/12/2009
However, I want to write: Where date = '07/12/2009', but I only want to return the results where there the customer has only one invoice...
So Custo...
Hi
I have a table of q-grams (2 letter strings). I need to join another table to this on the CHAR(2) field.
Would it be faster to convert these 2-grams into a number (e.g. aa=1, ab=2, ac=3) and convert the fields in both this table and the referencing table to an INT and join using an INT rather?
Kind regards
Peter
...
Hello, I need to find a string in the source code (DDL) for all stored procedures in Oracle schema.
I use this query to perform the task, but I think can be improved
SELECT T0.OBJECT_NAME
FROM USER_PROCEDURES T0
WHERE T0.OBJECT_TYPE='PROCEDURE'
AND INSTR( (SELECT DBMS_METADATA.GET_DDL('PROCEDURE',T0.OBJECT_NAME,'MySCHEMA')
...
Hello I would like to show a list of all messages with the date of the latest message.
I've acomplished the list.
SELECT COUNT(*) AS NumberOfTimes, TrackRecord.message_identifier, MessagesInstalledApplications.messageKind
FROM TrackRecord INNER JOIN MessagesInstalledApplications ON TrackRecord.message_identifier = MessagesInstalledAppli...
I have a SQL-Server 2008 database and a schema which uses foreign key constraints to enforce referential integrity. Works as intended. Now the user creates views on the original tables to work on subsets of the data only. My problem is that filtering certain datasets in some tables but not in others will violate the foreign key constrain...
I have a procedure written in PLJava that sends out updates over JMS in my postgres database.
What I would like to do is have that function called on an interval (every 15 seconds) internally in the database (preferably not from an outside process). Is this possible? Any ideas?
...
I have a table that has a primary key based on GUIDs. I need to find a record in this table based on the primary key and then delete this record and all the record that appear before it. Is there a command to delete preceding records or can anyone give me some example SQL on how I could do this.
I am using SLQ server 2008
...
I've used a table valued parameter before, but I'm not sure how to use xml.
I do not know the best way to format my xml but I think I would try this:
<Car>
<Name>BMW</Name>
<Color>Red</Color>
</Car>
Then I would pass the xml (one or more car) to the stored procedure and it would insert one row for each car I pass (with ...
I am using an MVC pattern to represent a table with many records of music albums. To each music album there are attributes (genre, artist, ratings, etc). Each attribute can have multiple values (so the genre of one album can be both "pop" and "latin", for example). I want to represent those attribute values using table(s).
So there are ...
Put simply... in plain SQL I would do this:
SELECT * FROM [Products] WHERE [Description] LIKE '%[0-9]%'
In Linq to Entities I do this:
Products.Where(p => p.Description.Contains("[0-9]"))
But I end up with this:
-- Region Parameters
DECLARE @p0 NVarChar(8) SET @p0 = '%~[0-9]%'
-- EndRegion
SELECT ...
FROM [Products] AS [t0]
WHERE ...
I know how to use date format strings, to turn date('Y/m/d H:i:s'); into 2009/12/18 11:37:45.
I would like a function that can do the opposite - look at a formatted date then return the format. Is there one in PHP?
The reason is we have timestamps saved in our database in a variety of formats and I am writing a tool processing all of ...
I have a SQL Report driven by a query that sorts it in ascending order of some numerical value. But the user wants two particular rows of data, which happen to appear at different ordinal positions in the query results, to be juxtaposed. Is there a way to do this, either through the report's driving SQL or the .rdl file itself?
...
I have a query that requires a where statement on a calculated value:
select * from table where date( timestamp ) = ?
An explain on this query yields the expected ALL select type, which is not ideal. Using MySQL, what's the best way to optimize this?
...
I have my database set up as such:
Each product I have has it's own table where it records the quantity sold/transaction # (so column 1 is "transactionID", column 2 is "quantity")
ex) p-backScratcher (where p- is indicative of "product")
There are also tables for each year which hold records of each transaction that went through. Eac...