Showing posts with label ngi. Show all posts
Showing posts with label ngi. Show all posts

Wednesday, March 7, 2012

Newbie?: Can This Be Done?- If so please direct

Hello NG
I have been working with Access for a Long Time - Am just now starting
to get my feet wet with SQL Server 2000 - We have a production database that
we have moved the tables to SQLServer and I have been creating stored
procedures to replicate some of the processes done on the access side - the
server does process extremely faster than access - Here is my problem I am
currently pulling info from SQL SERVER to Access once a w for wly
stats I want to create a stored procedure to process the wly stats and
push them to an access table upon request - we have multiple warehouses and
i would like to have the process coded once in sql and dump to the access
table based off a warehouse variable passed to the stored procedure - Can
SQLServer from a stored procedure export a recordset into a varible defined
Access Table?
TIAFAH
RandyIt sounds like DTS is what you're looking for. I don't know that I
would recommend this approach to an experienced SQL Server developer
because of its limitations, but in what you're asking for, it seems
ideal. Open Enterprise Manager, right-click your database, select
"Export Data" (it might be under a submenu), follow the wizard. I'm
pretty sure you can specify a stored procedure for the source. If I
remember correctly, you may also schedule the package to run at
intervals.
-Alan
Randy wrote:
> Hello NG
> I have been working with Access for a Long Time - Am just now starting
> to get my feet wet with SQL Server 2000 - We have a production database th
at
> we have moved the tables to SQLServer and I have been creating stored
> procedures to replicate some of the processes done on the access side - th
e
> server does process extremely faster than access - Here is my problem I am
> currently pulling info from SQL SERVER to Access once a w for wly
> stats I want to create a stored procedure to process the wly stats and
> push them to an access table upon request - we have multiple warehouses an
d
> i would like to have the process coded once in sql and dump to the access
> table based off a warehouse variable passed to the stored procedure - Can
> SQLServer from a stored procedure export a recordset into a varible define
d
> Access Table?
> TIAFAH
> Randy

Saturday, February 25, 2012

NEWBIE: TOP PREDICATE HELP

Hello NG
I am trying to use a declared variable of datatype INT within a SELECT
TOP n * FROM table WHERE clause ORDER BY column Statement. I keep getting an
incorrect syntax near my variable. What am I doing wrong?
IF @.varPRFI > @.varMinimumLabels
SELECT TOP @.varMinimumLabels * FROM [RestockLabels] WHERE
[PrintedCheck] = 0 AND UPPER([PRFI])='PULL FIRST'
ELSE
<do different Things>
TIAFAH
RandyTOP does not accept a variable in SQL Server 2000.
Try using SET ROWCOUNT, e.g.
SET ROWCOUNT @.varMinimumLabels
SELECT * FROM ... ORDER BY
You should also avoid SELECT * in production code.
A
"Randy" <randywfritz@.s@.nm@.r.com> wrote in message
news:eIWWAGY2FHA.2604@.TK2MSFTNGP12.phx.gbl...
> Hello NG
> I am trying to use a declared variable of datatype INT within a SELECT
> TOP n * FROM table WHERE clause ORDER BY column Statement. I keep getting
> an
> incorrect syntax near my variable. What am I doing wrong?
> IF @.varPRFI > @.varMinimumLabels
> SELECT TOP @.varMinimumLabels * FROM [RestockLabels] WHERE
> [PrintedCheck] = 0 AND UPPER([PRFI])='PULL FIRST'
> ELSE
> <do different Things>
> TIAFAH
> Randy
>|||OK TY
Now that brings up another dilemma. Let me expand - I need to get 15
Records I am looking for Priority records first if my priority records
exceed 15 then I get only 15 if they are less then 15 I need to get enough
records to make 15 - I had intended to use a UNION Query to get my 15 by the
following
IF @.varPRFI > @.varMinimumLabels
SELECT TOP @.varMinimumLabels * FROM [RestockLabels] WHERE
[PrintedCheck] = 0 AND UPPER([PRFI])='PULL FIRST'
ELSE
SET @.varMinimumLabels = @.varMinimumLabels-@.varPRFI
SELECT * FROM [RestockLabels] WHERE [PrintedCheck] = 0 AND
UPPER([PRFI])='PULL FIRST' UNION SELECT TOP @.varMinimumLabels * FROM (SELECT
* FROM [RestockLabels] WHERE [PrintedCheck] = 0 AND UPPER([PRFI])<>'PULL
FIRST')
Will SET ROWCOUNT Still accomplish this task when I remove the top predicate
form my Union SELECT Statement and will I also be able to insure that I get
my priorities - I do not have an order by clause on the union select - I
haven't gone that far yet but when I do will I lose priorities to non
priorities because my nons will be above in the ordered by result and then
getting the rowcount of the union query. I hope I made this clear enough.
Again TIAFAH
Randy
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:OTh1XHY2FHA.4004@.TK2MSFTNGP09.phx.gbl...
> TOP does not accept a variable in SQL Server 2000.
> Try using SET ROWCOUNT, e.g.
> SET ROWCOUNT @.varMinimumLabels
> SELECT * FROM ... ORDER BY
> You should also avoid SELECT * in production code.
> A
>
> "Randy" <randywfritz@.s@.nm@.r.com> wrote in message
> news:eIWWAGY2FHA.2604@.TK2MSFTNGP12.phx.gbl...
SELECT
getting
>