Tuesday, March 20, 2012
Question on repeated query
state zip, etc. from a list of customers.
I have to select 2000 records from each of 29 states.
Is there a way to do this without repeating and repeating the code in
QA, or by changing the state manually and running it each time?
I have to select 2000 customers from WV, 2000 from VA, 2000 from FL,
2000 from TX and so on.
It's more of just a random selection of customers, with no other
requirements other than the name & address are a good one (i.e. non-null
last name, good zip code, etc).
Any help appreciated.Try,
select
Name Address, city, state, zip
from
t1 as a
where
customerid in (
select top 2000 customerid
from t1 as b
where b.state = a.state
)
go
If you run this query again, do not expect to pull same result because I am
not using "order by" clause.
AMB
"Blasting Cap" wrote:
> I have to select a number of fields for a report. Name Address, city,
> state zip, etc. from a list of customers.
> I have to select 2000 records from each of 29 states.
> Is there a way to do this without repeating and repeating the code in
> QA, or by changing the state manually and running it each time?
> I have to select 2000 customers from WV, 2000 from VA, 2000 from FL,
> 2000 from TX and so on.
> It's more of just a random selection of customers, with no other
> requirements other than the name & address are a good one (i.e. non-null
> last name, good zip code, etc).
> Any help appreciated.
>
Wednesday, March 7, 2012
Question on deploying .SQL files
I would not like my customers to have access to any SQL code that is
being packaged with our product and hence would like to encrypt it in
some fashion. What's your recommendation on packaging/deploying .sql
files?
Would appreciate any feedback.
Thanks,
Sandeep Madduri.Sandeep Madduri's group (sandeepmadduri@.gmail.com) writes:
Quote:
Originally Posted by
I would not like my customers to have access to any SQL code that is
being packaged with our product and hence would like to encrypt it in
some fashion. What's your recommendation on packaging/deploying .sql
files?
First of all, keep in mind that while you can create a stored procedure
WITH ENCRYPTION, it is not real encryption, but merely obfustication.
Any users who is dead set will be able to recover the original code.
(Can easily be found on Google.) That is not to say that WITH ENCRYPTION
is useless. It does act like a sign saying "NO TRESPASSING" and will
keep honest people out. But you still need a license agreement.
As for the setup, you could ship the files in some obfusticated
fashion, and then have a program that knows how to "decrypt" the files
and then pass them to SQL Server unecrypted.
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx