Hi Daniel, I was just trying this yesterday an apparently Sample doesn't work when loading QVD files, at least not when being loaded optimized. It will work when loading from a resident table.
Another thing I found is that the parameter is inverted, if you want a 20% sample you need to write Sampl 0.8 load.
Couple of things I have found, if your source data is in a .qvd file then sample wont work. If it is an inline or autogenerated type table it will work. Also if your source is in an .xls file it will work... Finally, it doesn't return an 'exact' 10% sample... The 1st 3 examples below work, the 4th (ZIPtable) returns all records.
LOAD Rand() AS Random1
LOAD Rand() AS Random2
sample .1 LOAD
Resno as sample_res
(biff, embedded labels, table is Sheet1$);
sample .1 LOAD ZIP as sample_zip,
TYPE as sample_type
FROM ZIP.qvd (qvd);
Hope that helps!
If your table is not big enough there is a change you will not get any record.
I wrote this piece of code and I get different number of lines in the result when I reload it.
It's ok since p is a probability to get a line.
LOAD * INLINE [
Sample 0.5 load * resident Test;
drop table Test;
If you want to control how many lines you get you can include rand() as a field in the load. Then, in a second step, you use `where rowno() < x' to get x lines from your table.
Hope this helps,