I have SQL SELECT query which returns a lot of rows, and I have to split it into several partitions. Ie, set max results to 10000 and iterate the rows calling the query select time with increasing first result (0, 10000, 20000). All the queries are done in same transaction, and data that my queries are fetching is not changing during the...
How to find the text field data has \n in mysql?
for ex :
field :
address :asfalghaln asdgl sdnslbvaslcbn
address2 : adsadas
phone :2323
How to find the address has \n or not ? in mysql
...
Hi,
I have a column called THE_VALUE in a table TABLE_A, that holds data similar to the following, i.e a few sample rows might be:
tom:harry, sally, jeff
state(vic,nsw), england, qwerty(aaa,bbb, cccc):qaz
What I need to do to update this column using Oracle 10g sql and replace all commas, except the ones within the brackets with a co...
Hallo all, i have this SQL
SELECT DATE_ADD( '2009-'+ MONTH( NOW() ) +'-01' , INTERVAL -1 MONTH );
i can't get it to work, what i make wrong here?
tanks for help.
...
Hi,
The problem that i'm having is how can i synchronise my datasets in my VS 2008 project to any changes in the database.
As you know we read data from the db into the dataset which is disconnected, now lets say 1 minute later something updates the data in the database. What i want to do is after a set time interval check the db for...
Hi all
(Using SQL Server 2008)
I need some help visualizing a solution. Let's say I have the following simple table for members of a pension scheme:
[Date of Birth] [Date Joined] [Date Left]
1970/06/1 2003/01/01 2007/03/01
I need to calculate the number of lives in each age group from 2000 to 2009.
NOT...
I'm trying to create a cube where the total is taken from an attribute on the fact and not calculated as an aggregate of the children in SSAS 2005. For example
Assume I have 10 stores which all had 100 customers visit on a particular day. There was however some overlap where some customer visited multiple stores. The total visitors f...
This feels like it should have a basic solution but I don't seem to be getting it.
Take this query:
SELECT Category FROM Article
GROUP BY Category
I want to effectively do this:
SELECT Category, DatePublished FROM Article
GROUP BY Category
ORDER BY DatePublished DESC
I d...
I would like to write a query that simply returns 1 or 0 depending if there will be results.
I am thinking to use this
IF EXISTS(
select * from myTable
where id=7 and rowInsertDate BETWEEN '01/01/2009' AND GETDATE()
)
SELECT 1
ELSE
SELECT 0
That's the general premise.
The final results will actually be a far more compl...
Hi All,
I've an SSIS package that runs a stored proc for exporting to an excel file. Everything worked like a champ until I needed to a do a bit of rewriting on the stored proc. The proc now takes about 1 minute to run and the exported columns are different, so my problems are the following;
1) SSIS complains when I hit the preview ...
Simplistically I have a table that looks like this:
ColA | ColB |
-----+------+
EE34 | Woo |
ER56 | fro |
EE34 | eco |
QW34 | Sddg |
EE34 | zoo |
ER56 | safe |
I need a select statement for SQL Server that produces:
ColA | Count |
-----+-------+
EE34 | 3 |
ER56 | 2 |
QW34 | 1 |
This could be running over a table wit...
I have the following data in a table TABLE1
DOCUMENT ------ FIELD1
12345
23456
34567
45678
98765
i have the following data in a view VIEW1
DOCUMENT ---- BUS
12345 ------------ 5
23456 ------------ 6
34567 ------------ 8
45678 ------------ 12
98765 ------------ 14
What i would like to do is update each row
if (table1.document = v...
I searched SO for a pertinent question existing already but couldn't find one.
I am setting up a Read-only database role for a few databases in our server farm. Here is a sample of the permissions for one table:
GRANT SELECT ON [dbo].[Table] TO [ReadOnly]
GRANT VIEW DEFINITION ON [dbo].[Table] TO [ReadOnly]
DENY ALTER ON [dbo].[Table] ...
We're required to add Ordering to our EventVenue table, which we've done by adding an int field to store the EventVenue's placing in the order. The ordering is based upon the parent Event's ID and the Event's VenueGrouping.
If the VenueGrouping is false the EventVenues will be ordered sequentially. However, if true, the EventVenues for ...
I've hit an interesting snag (interesting to me at least). Below is a general idea of what my query looks like. Assume @AuthorType is an input to the stored procedure and that there are various specialized conditions each place I've put comments.
SELECT *
FROM TBooks
WHERE
(--...SOME CONDITIONS)
OR
(@AuthorType = 1 AND --...DIFFERENT ...
Is it possible to execute a stored procedure inside a trigger?
Thank you
...
Hi folks
Can someone set me straight on the correct syntax for this statement?
I am trying to update a new field in table rounds with an average of a field in table holes where rounds.id is stored as a foreign key.
UPDATE `rounds` SET drivingDistance_avg_per_hole =
SELECT SUM(holes.drivingDistance)/COUNT(holes.drivingDistance) as av...
I'm trying to use PowerShell to create some backups, and then to copy these to a web folder (or, in other words, upload them to a WebDAV share).
At first I thought I'd do the WebDAV stuff from within PowerShell, but it seems this still requires a fair amount of "manual labour", ie: constructing HTTP requests. I then settled for creating...
cat_id prod_name parent_cat_id
------ ---------- ------------
1 prod_1 2
2 prod_2 5
3 prod_3 1
4 prod_4 3
5 prod_5 7
6 prod_6 5
In a recursive function, make a table and by using these, if cat_id = 1 and parent_cat_id = 1 take that product name and if that product category id and parent category id is sam...
I am working with an existing architecture which populates fields on a form with things from the database. The form is entirely database driven and is done in PHP and MySQL.
The problem is that the database table that holds the form elements has a field for the query that will return a result set that will be used to populate the select...