I'm playing with the Output keyword in SQL Serer 2005 Express. I've written the following query:
Declare @tempTable as Table(masterLotDB datetime)
Insert into dbo.tblMasterLot (RecordCreation)
Values ('2009-10-02')
OUTPUT INSERTED.RecordCreation
into @tempTable
I get a syntax error of Msg 102, Level 15, State 1, Line 6
Incorrect syn...
Is there any way to speed up bulk inserting in 2005? I'm looking into partitioning, is it good?
...
I have a products table, that has a manufacturerID that is currently -1 for all the products.
I have a manufacturer table that has a SKU prefix.
So if a MFG sku prefix is: ABC
Then the products table will have products like ABC123, ABC3434.
So I need a query to update the products table, to set the manufacturerID based on the skuPref...
Basically I have a table like this:
CREATE TABLE Person(
PersonID int IDENTITY(1,1) NOT NULL,
FirstName nvarchar(512) NOT NULL,
LastName nvarchar(512) NULL
)
And I need to find the top n results based on a user-query like this:
"Joh Smi"
The following query returns the results I need (I think). Just not in the relevant ...
Can I throw an exception on the SQL 2005 server so that I can catch it in C# code with SqlCommand.ExecuteQuery()?
...
Hello there,
Im trying to find records in a VARCHAR column that may contain a NUL (0x00), and I cannot find a way to locate the NUL character.
Any ideas are welcome.
-Israel
...
Query #1:
SELECT DISTINCT `title`
FROM `table`
WHERE (
`title` LIKE '%this is search%'
)
OR (
`title` LIKE '%this%'
AND `title` LIKE '%is%'
AND `title` LIKE '%search%'
)
OR (
`title` LIKE '%this%'
OR `title` LIKE '%is%'
OR `title` LIKE '%search%'
)
LIMIT 0 , 10
but not works good , and when I try splited this sql:
Query #2:
SELE...
Suppose I have a table of users.
Something like:
ID integer,
USER text,
POSITION integer
My db tuples can be:
(1, "user1", 1);
(2, "user2", 2);
(3, "user3", 3);
My app lists all users and it has the possibility to reorder it.
For example:
You can make user3 go before user2.
(1, "user1", 1);
(2, "user2", 3);
(3, "user3", 2);
Also...
I have a table as below
Name Priority Date
-------------------------
A 2 d1
B 3 d2
How to write a query to achieve the below output
ColumnNames d1 d2
--------------------------
Name A B
Priority 2 3
Thanks
...
Specifically, I'm trying to figure out if it's possible to generate SQL that does what I want to feed into Ruby-on-Rails' find_by_sql method.
Imagine there are Users, who are joined cyclically to other Users by a join table Friendships. Each User has the ability to create Comments.
I'd like a SQL query to return the latest 100 comment...
Is it possible to impose conditions on a SQL query to the greater of two conditions?
For example, imagine a site that has Posts. Is there a way to request posts such that the result will be guaranteed to contain both of at least all posts made in the past 24 hours, and at least 10 posts, but not unnecessarily exceeding either limit?
I...
I have the following SQL table -
Date StoreNo Sales
23/4 34 4323.00
23/4 23 564.00
24/4 34 2345.00
etc
I am running a query that returns average sales, max sales and min sales for a certain period -
select avg(Sales), max(sales), min(sales)
from tbl_sales
where date between e...
News sites usually have a featured section and some category based news. The featured articles belong to a category but when they're featured they don't show up in the category section - what's the common way of doing this? Should I save a list of all the articles that are featured, then grab the latest news from each category, except pr...
Using Delphi 2009 + Firebird 2.1.3.
Database is ODS 11.1, default char set is UTF8.
My prepared query is as follows:
SELECT
a.po_id, a.po_no
FROM
purchase_order a
WHERE EXISTS
(SELECT 1
FROM
sales_order_item z1
JOIN
purchase_order_item z2
ON
z2.so_item_id = z1.so_item_id
AND
z2.po_id = a...
EDIT: TL;DR version
I typed this
CREATE INDEX IF NOT EXISTS IDX_FILE_SIZE table_name (file_size);
instead of this
CREATE INDEX IF NOT EXISTS IDX_FILE_SIZE ON table_name (file_size);
Don't do that.
...
See this Image below
http://i46.tinypic.com/2pt6jkn.jpg
This is report in SSRS as shown when it is uploaded in the server.
On my developement machine, the format is ok as shown in the pic below.
http://i48.tinypic.com/be9dmh.jpg
Why is the format getting messed up?
...
Hi,
Can you have a single SQL that order events by current day then future dates and within current day and future dates in alphabetic order?
Please show me an example?
Thanks :)
...
Hi,
I am trying to alter a datatype for a derby db column. The current price column is set as DECIMAL(5,0). I would like to alter it to DECIMAL(7,2). I did this :
alter table item alter column price set data type DECIMAL(7,2);
But it did not work, and showing the error:
Error: Only columns of type VARCHAR may have their length alte...
I know SQL well but I must be missing something really dumb here. This update query keeps throwing an error. The query is:
UPDATE pages SET 'order' = 1 WHERE id = 19
The table definitely has a column for order, and it has a record with the ID of 19. The order column is not unique.
The error I get is the generic one:
#1064 - You hav...
I have a simple weighted graph
A
1 / \\ 0.5
/ \\0.5
B C
Suppose this describes a family and A is the father, B is the son and C is the mother. Let's say B is studying in an university and A has bought an apartment for him. A is living with C in a house which is commonly owned, 50-50.
I want to transform the graph into a...