It's me, one more time. My last request didn't quite filter all my records,
I have one more field I need to evaluate in the script.
DESCR TYPE SELL StartDate EndDate Number
65048 04 Price A 4/21/2004 4/26/2004 35456
65048 06 Price C 4/20/2004 4/27/2004 35459
65048 08 Price B 4/22/2004 4/28/2004 34559
65049 04 Price A 4/19/2004 4/24/2004 38595
65049 06 Price B 4/22/2004 4/25/2004 38594
65049 06 Price C 4/20/2004 4/29/2004 38998
65050 07 Price A 4/21/2004 4/25/2004 38112
65050 06 Price B 4/18/2004 4/28/2004 38550
65050 07 Price C 4/17/2004 4/29/2004 38110
Descr, Type, Sell and Number are CHAR
StartDate and EndDate are SmallDatetime
I need a simple query that would display the records with the following
criteria:
#1. "Date I Enter" >= Startdate
#2. "Date I Enter" <= Enddate
#3. Highest TYPE for each DESCR
#4. Highest NUMBER for each TYPE/DESCR (the tie-breaker)
Results for ("Date I Enter" = 4/23/2004) should be:
65048 08 Price B 4/22/2004 4/28/2004 34559
65049 09 Price C 4/20/2004 4/29/2004 38998
65050 07 Price A 4/21/2004 4/25/2004 38112
I REALLY appreciate the help!
Thanks!!
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
select count(a.callid) from tbl1 as a inner join tbl2 as b on a.calldefid=b.calldefid where a.programid=175
select count(a.callid) from tbl1 as a inner join tbl2 as b on a.calldefid=b.calldefid where b.programid=175
callid - pk on tbl1 calldefid - nonclustered index on both tbl1 and tbl2 programid - nonclustered index on both tbl1 and tbl2 tbl2 is the smaller table
from my understanding, the second query will run faster because you reduce the records in the smaller table, then join to the larger table (tbl1).
but can you explain to me why limiting the rows on tbl1 first, then joining to tbl2 would take longer?
I am having a problem with what appears to be a very trivial task in the graphical query designer. When I enter =@County into the filter column quotes are automatically added like = '@County' which the makes the query string inaccurate (looking for a literal County = "@County" in the where clause).
I am using Studio 2005 and SQL Server 2005 with the newest service packs and retreiving data from an Oracle 10G database.
If I remove the quotes and run the query through the generic query designer in my SQL reporting project I get the error "ORA-00936: missing expression".
It is as if the SQL Reporting Project does not understand the meaning of the @ symbol for entering a parameter.
What am I missing here? I thought @ specified that this would be a parameter and you then just needed to supply the values for the parameter.
Im having a issue. Im not sure how I am going to carry out but I have two tables in SQL server 2005 TABLES Category SubCategory (PK)CategoryName (PK) SubCategoryNameCategoryID SubCategoryIDDate Date (Just shows the date inserted) (FK)CategoryID On the front page, I need to have it querys out the CategoryName from Categorys but also querys out all....Well not all but atleast 5 subcategorys that relate to that categoryName. Once its down it moves to the next category and does the same and so on. Does anyone know the trick ?
I have a stored procedure that calls some UDF User Defined Functions,the purpose of which is to create row strings out of numerous columnstrings for matching uniqueIDs.The problem is I need to join that SP with some other tables.The SP I have reads something like:mySPName@myUserID intSELECT myUniqueID, dbo.fn_myFunctionName(UniqueID) As myRunningStringFROM myTEMPTableNameGROUP BY myUniqueIDWHERE myTEMPTableName.UserID = @myUserIDI need to join that result with myTableName on myUniqueID such as:Select myTableName.myField1, myTableName.myField2,mySPName.myRunningStringFrom ...-- joining myTableName.myUniqueID = mySPName.myUniqueIDCan this be done?The reason I don't just do it with a View instead of an SP is that Ihave that parameter that must be passed to filter the records inmyTEMPTableName.Any help is appreciated.lqoh...the UDF looks like:Create Function dbo.fn_myFunctionName(@myUniqueID as int) returnsnvarchar(500)ASBEGINDECLARE @ret_value nvarchar(500)SET @ret_value=''SELECT @ret_value=@ret_value + ';' + myStringFROM myTEMPTableNameWHEREmyUniqueID =@myUniqueIDRETURN RIGHT(@ret_value,Len(@ret_value)-2)END
Hopefully someone can point me in the right direction, I've been searching on the net for the answer to this question and can't seem to come up with anything. First, I'm using ASP.NET 2.0 and Visual Studio 2005 with a SQL Server 2000 backend. My SQL database is relational and is used to store names, addresses, etc of other companies. What I need to be able to do is have 2 transactions, one nested within the other. In pseudo-code: BEGIN TRANSACTION1
BEGIN TRANSACTION2 INSERT INTO COMPANY TABLE COMMIT TRANSACTION2 -OR- ROLLBACK TRANSACTION2 GET COMPANYID JUST ADDED PERFORM REMAINING INSERTS COMMIT TRANSACTION1 -OR- ROLLBACK TRANSACTION 1 & 2 Right now I have everything grouped into one VB.NET transaction, which doesn't work because the company is not actually added until the transaction reaches commit. Therefore, I can't retrieve the companyID halfway through. Is what I'm trying to do even possible? Thanks in advance for the help!
Hi, i have to nest 2 cursors together and frankly i'm lost.
Here's what I have so far
CREATE PROCEDURE SeeAllColumns AS SET NOCOUNT ON DECLARE @strMessageVARCHAR(100) DECLARE @strColumnVARCHAR(100) DECLARE @strTableVARCHAR(100) DECLARE @strCommandVARCHAR(250)
SELECT @strMessage = 'SELECT ALL TABLES' PRINT @strMessage DECLARE crsTables CURSOR FOR SELECT name AS strTable FROM sysobjects WHERE name LIKE 'T%'
OPEN crsTables FETCH NEXT FROM crsTables INTO @strTable WHILE (@@FETCH_STATUS = 0) BEGIN
SELECT @strMessage = 'SELECT ALL COLUMNS' PRINT @strMessage
What i need to do is select all columns from all tables, but none of the actual data within the columns, just the names. I just don't know where or how to insert the 2nd cursor. Can someone help me?
I am developing the security in a sql database, and i am doing so in a hierarchical way. In the white paper Row and cell security it says that we must add the child role as a menber of the parent role, but when you are in the role section you can not add roles as menbers of another role, so what i did was give the parent role ownership over the child role, it seemed logical.
So i build a admin | boss | worker | subworker
Nested Role
Now after giving users to those roles i was good to go and try my hierarchy security, i used the view that is in the white paper cell and row security which the code is the following:
SELECT ID, Label FROM dbo.tblUniqueLabel WITH (NOLOCK) WHERE (ID IN (SELECT dbo.tblUniqueLabel.ID FROM dbo.tblUniqueLabelMarking WITH (NOLOCK) WHERE (CategoryID = 1) AND (IS_MEMBER(MarkingRoleName) = 1)))
But when i runned this view dont matter which users in which role ist always giving me an output of every single line in the table, the problem seem that he is giving me out the IS_MEMBER(MarkingRoleName) = 1 always as true like the user was in every single role.
hi I have another question to ever so helpful forum I am trying to nest stored procedure but I guess it is not the way to do it as it does not work:
CREATE PROCEDURE dbo.GetSharesTransactionsbyDates
( @Startdate as char(10), @Enddate as char(10)
)
AS
dbo.GetSharesTransactionsData /*tryting to nest sproc*/ WHERE TRANS_DATE BETWEEN @Startdate and @Enddate
I get complain that dbo is incorrect syntax
ST.Proc. which I try to call call is basicly a select statement with no parameters:
ALTER PROCEDURE dbo.GetSharesTransactionsData AS SELECT TRANS_DATE, TYPE_DESCRIPTION, SHARE_SYMBOL, SHARES_QUANTITY, ROUND(PRICE_PER_SHARE,2) AS PRICE_PER_SHARE, COMMISSION_VALUE, STAMP_DUTY, dbo.GetShareTransactionTotalValue(PRICE_PER_SHARE,STAMP_DUTY,COMMISSION_VALUE, SHARES_QUANTITY,CASH_AMOUNT, TYPE_DESCRIPTION) AS TOTAL_VALUE,/*calling function*/ ACCOUNT_NAME FROM SHARES_TRANSACTIONS WHERE (TYPE_DESCRIPTION = 'Sell') OR (TYPE_DESCRIPTION = 'Buy') OR (TYPE_DESCRIPTION = 'Cash Divident') ORDER BY TRANS_DATE
I am wondering if there is a way that we could do a nesting case statement in an SQL Query?
This is what I have now... FicaWages = CASE WHEN (UPR00900.FICAMWGS_1 + UPR00900.FICAMWGS_2) >= '84900' AND UPR00400.SBJTSSEC = 1 THEN '0' WHEN UPR00400.SBJTSSEC = 0 THEN '0' ELSE (UPR30100.GRWGPRN - (SELECT SUM(UPR30300.UPRTRXAM) FROM UPR30300 WHERE UPR30300.EMPLOYID = UPR00100.EMPLOYID AND UPR30300.PAYROLCD LIKE '3%' AND AUCTRLCD = 'UPRCC00000007')) END
What I want:
FicaWages = CASE WHEN ('Sql Statement') = 'GRM' THEN CASE WHEN (UPR00900.FICAMWGS_1+UPR00900.FICAMWGS_2) >= '84900' AND UPR00400.SBJTSSEC = 1 THEN '0' WHEN UPR00400.SBJTSSEC = 0 THEN '0' ELSE (UPR30100.GRWGPRN - ('Sql Statement')) END ELSE CASE WHEN (UPR00900.FICAMWGS_1+UPR00900.FICAMWGS_2) >= '84900' AND UPR00400.SBJTSSEC = 1 THEN '0' WHEN UPR00400.SBJTSSEC = 0 THEN '0' ELSE (UPR30100.GRWGPRN - ('Sql Statement')) END END
I am constantly running into this error when calling CLR functions from triggers (even when the triggers are CLR functions themselves): The context transaction which was active before entering user defined routine, trigger or aggregate "[name of CLR sp]" has been ended inside of it, which is not allowed. Change application logic to enforce strict transaction nesting.
However, there is no cyclic nesting going on here. In fact, the error only appears when the CLR function is writing to the database. Only executing SELECT statements inside the statements doesn't freak out the SQL server (2005 SP1 in my case). I am not ending any transaction at all. This error shows up in many places: as exceptions from ASP.NET web pages, as errors in the msmerge_conflicts_info etc. Now I saw in the thread: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=457818&SiteID=1 ..that this was supposedly a known bug in CLR. But in my case, it appears that I can't call a single CLR inside a trigger if the CLR is supposed to write something to the database, which is a pretty severe limitation of CLR imho.
I was trying to figure out if I can avoid this error by escaping the transaction context, I tried that inside CLR (Using New TransactionScope(TransactionScopeOption.Suppress)) but it didn't work. Also, calling COMMIT TRANSACTION before calling the CLR doesn't seem to solve the problem since it's not suppose to end the ambient transaction of the trigger according to BOL, and in many cases it doesn't seem wise to do so, e.g. if the trigger is fired in merge replication as in my case.
I have sort of a weird error when attempting to create a database in SQL 2005 (migrating from SQL 2000 to SQL 2005).
I am able to run the CREATE PROC script just fine in SQL 2000, but I get this error in SQL 2005.
Msg 191, Level 15, State 1, Procedure udf_JCMS_ConcurrencyCheck, Line 2518 Some part of your SQL statement is nested too deeply. Rewrite the query or break it up into smaller queries
I can't easily past up the whole script(it's 2655 lines), but it basically takes the following form:
CREATE FUNCTION dbo.Ugly ( @PK1 int, @PK2 int, @PK3 int, @TableID int, @UpdateBy char(30), @LastUpdate datetime ) RETURNS BIT
DECLARE @UpdatedStatus as bit DECLARE @RecordCount as smallint
SET @RecordCount = 0 If @TabelID = 1-- Comment about TableName BEGIN
SELECT @RecordCount =count(UNIQUE_ID) FROM dbo.MyTable WHERE UNIQUE_ID = @PK1 ANDPROXY_ID = @PK2 ANDLTRIM(RTRIM(ISNULL(LAST_UPDATE_BY,'')))= LTRIM(RTRIM(ISNULL(@UpdatedBy,''))) AND ( isnull(LAST_UPDATE_DATE,'') = isnull(@UpdatedDt,'') or convert(datetime,convert(varchar(10),LAST_UPDATE_D ATE,101) + ' ' + convert(char(8), LAST_UPDATE_DATE,8)) = @UpdatedDt ) END
If @TableID = 2 -- Comment about TableName BEGIN . . . END
If @TableID = 3 -- Comment about TableName BEGIN . . . END
...
If @TableID = 156 -- Comment about TableName BEGIN . . . END
IF @RecordCount = 0 SET @UpdatedStatus = 1 ELSE SET @UpdatedStatus = 0
RETURN @UpdatedStatus
First, THIS IS NOT MY CODE.
Second, it appears that they are trying to create a function to test if a record has been updated (I cut out a bit of that).
I don't really get why SQL 2005 throws an error here. Yes, the code is hideous and not something that I would write myself. But it's not like the function is calling itself recursively or anything.
I was hoping someone could help out with this issue....I've got a report I created in Reporting Services 2000 SP2 where I am nesting table elements within the row and detail sections of the matrix. This allows me to have multiple items within my "row" data with column headings, and works perfectly fine within the designer, and viewer, and whenever I export it to any format other than Excel. Exporting to excel results in a "Specified cast is not valid" error.
To me this seems to be a bug in the Excel rendering extension, since it seems to be supported in RDL. Has anyone else run into this? Is there a fix to the renderer or a workaround that anyone is aware of?
I'd be happy to post the RDL if anyone is interested.
I have writen a Function which call's the same function it self. I'm getting the error as below.
Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32). Can any one give me a solution for this problem I have attached the function also.
CREATE FUNCTION dbo.GetLegsFor(@IncludeParent bit, @EmployeeID float) RETURNS @retFindReports TABLE (EmployeeID float, Name nvarchar(255), BossID float) AS BEGIN IF (@IncludeParent=1) BEGIN INSERT INTO @retFindReports SELECT MemberId,Name,referredby FROM Amemberinfo WHERE Memberid=@EmployeeID END DECLARE @Report_ID float, @Report_Name nvarchar(255), @Report_BossID float DECLARE RetrieveReports CURSOR STATIC LOCAL FOR SELECT MemberId,Name,referredby FROM Amemberinfo WHERE referredby=@EmployeeID OPEN RetrieveReports FETCH NEXT FROM RetrieveReports INTO @Report_ID, @Report_Name, @Report_BossID WHILE (@@FETCH_STATUS = 0) BEGIN INSERT INTO @retFindReports SELECT * FROM dbo.GetLegsFor(0,@Report_ID) INSERT INTO @retFindReports VALUES(@Report_ID,@Report_Name, @Report_BossID) FETCH NEXT FROM RetrieveReports INTO @Report_ID, @Report_Name, @Report_BossID END CLOSE RetrieveReports DEALLOCATE RetrieveReports
I am running this query "delete from ims_domains where id=61" and got the error Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32)
Please let me know what should be the reason? Thanks, Ravi
I face this error when i try to run my store procedure. The sample of store procedure as following:
SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO
CREATE PROCEDURE sp_addUserAccess with encryption AS SET NOCOUNT ON
DECLARE @COUNTER INT SET @COUNTER = 0
DECLARE @i_compId INT BEGIN DECLARE C1 SCROLL CURSOR FOR SELECT i_compId FROM ltd_cms_company WHERE (i_owner = 176 or i_owner = 268) AND ti_recStatus = 1 END
OPEN C1 FETCH ABSOLUTE @COUNTER FROM C1 INTO @i_compId
Hi all, I get this message when trying to update a tabel i have whichhas nested hierarchies.The current hierarchies beginning from root = 1 are up to the level 5.Before going into details and sample data with all the sql queries andprocedures, this limitation from Microsoft for nested levels .. isthere any way or trick to increase the level in generic?
I have created a delete trigger in Table1 and Table2. Once I delete a certain record in Table1 it will also delete that record in Table2 or vice versa. But once i delete certain record either in Table1 or Table2 it will create an error "Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32).". Can you help me on this?
Having serious problems trying to insert date into database using sqladapter.update method gives an error saying "Converting DateTime from Character string". the funniest thing is that it works on my developement box, but when i upload to the server with thesame settings in my development box, it does not work.
Hi, I will give someone a script that creates a database using : create database mydatabase my question: can I use myDatabase.dbo...... and myDatabase..Whatevertable in order to manipulate the database objects or should I be careful with putting dbo in my script.
The reason is that I will have to give the following script to someone to execute on his instance and I don t want it to fail.
The script creates a database mosaikDB737, create a table called FileListInput in that database and populates a second table called DBlistOutput with the list of names of all databases in the instance.
Please let me know if there are any (BAD) chances for the following script to fail.
create database mosaikDB737 go use mosaikDB737
SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FileListInput]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[FileListInput]( [FileName] [char](50) NULL ) ON [PRIMARY] END
use master select name into mosaikDB737.dbo.DBlistOutput from sysdatabases where name not in ('master','tempdb','model','msdb') select * from mosaikDB737.dbo.DBlistOutput
OK, so I'm new to SQL server, which I'm sure you'll all see from my question below.
I am trying to migrate an access DB with queries over to sql server 2005. simple queries I can handle, but I've come accross a query that calls another query and does an update based off of my first query. The below queries work perfectly fine in access but I dont know how to get this going in SQL server. From my VERY minimal understanding in of SQL server i thought we couldnt call stored procedure (query1) and have it update the underlying tables. If I'm wrong, please show me how its done, If I'm right please show me the right way of doing this. If you see spelling errors in the queries please ignore, that is not the full queries, it is just a cut down version to explain what I need to be able to do.
Query1
SELECT table1.assettag, table1.City, table2.Status, table2.ScheduleItems FROM Table1 Inner join on table1.assettag = table2.assettag where Status = "Scrubbed" or Status = "Initial"
Query2
Update Query1 SET query1.ScheduledItems = True Where query1.Status = Scrubbed
I have never used coding before (just learning) and I need to collect username and password and check it against my SQL database. I am using the below code as a sample guide for me to figure this out. Does anyone point me to a sample code page that I may look at that actually is doing what I want to do??
Sondra
Protected Sub submit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles submit.Click
Dim myReader As Data.SqlClient.SqlDataReader
Dim mySqlConnection As Data.SqlClient.SqlConnection
Dim mySqlCommand As Data.SqlClient.SqlCommand
'Establish the SqlConnection by using the configuration manager to get the connection string in our web.config file.
mySqlConnection = New Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ToString())
Dim sql As String = "SELECT UserLogonID, UserPassword FROM MyUsers WHERE UserLogonID = '" & Me.userid.Text & "' " And "Userpassword = '" & Me.psword.Text & "'"
mySqlCommand = New Data.SqlClient.SqlCommand(sql, mySqlConnection)
Try
mySqlConnection.Open()
myReader = mySqlCommand.ExecuteReader()
If (myReader.HasRows) Then
'Read in the first row to initialize the DataReader; we will on read the first row.
myReader.Read()
Dim content As ContentPlaceHolder
content = Page.Master.FindControl("main")
Dim lbl As New Label()
lbl.Text = "The Last Name you choose, " & Me.dlLastName.Text & ", has a first name of " & myReader("FirstName")
content.Controls.Add(lbl)
End If
Catch ex As Exception
Console.WriteLine(ex.ToString())
Finally
If Not (myReader Is Nothing) Then
myReader.Close()
End If
If (mySqlConnection.State = Data.ConnectionState.Open) Then
I read a few articles on best SQL practices and they kept coming back to using a Least Privileged Account. So I did so and gave that account read only permissions. The articles also said to do updates use Stored Procedures - so I created stored procedures for updating/deleting data.So here's my problem - I connect to the database using the Least Privileged Account, I use the Stored Procedures, but .NET keeps saying I lack permissions. If I GRANT the Least Privileged Account UPDATE/DELETE permission on the table, the Stored Procedures run perfectly. But isn't that EXACTLY what I'm trying to avoid?My greatest concern is someone hacks my website and using the Least Privileged Account, they delete all my data using that account. So I don't want to give the Least Privileged Account the Update/Delete privileges.Thanks a MILLION in advance!
I have just started on a project which will be based on an existing MS SQL Server database. It has many columns which can be, and sometimes are, null. My basic DataReader code throws an SqlNullValueException when I try to GetInt32 but not when I try GetString. Why the difference? Also, how do I model my class? Do I have to make all fields into nullable types? If I do that I notice a simple GridView will not show a column for that field! I am confused.
I am calling a sql 7.0 stored procedure (sp) from an active server page(asp).
The sp is a simple insert. I need to read the return the value of the sp in my asp. If the insert is successful, my return value is coming back correctly (to whatever i set it)....but if there is an error such as a Uniqueness Constraint, I can't get the return code(set in the SP) to come back to the ASP. It comes back blank. (The literature I've read says that processing should continue in the SP, so you can perform error processing...is that right?)
I set the return var in my ASP as: objCommand.Parameters.Append objCommand.CreateParameter("return",_ adInteger,adParamReturnValue,4) and read it back as: strReturn = objCommand.Parameters("return").Value
In my SP I simply do;
INSERT blah blah if @@error = 0 return(100) else return(200)
I have study Microsoft online books for few days no, about repliction but I'am even more confused about replication. please help somebody
My goal:
I have been written a GPS program that has an database. The database will be replicated to an central web server. That will say one web server and x numbers of laptops that has same GPS program. :) All laptops uses internet to replicate.
Now... I have no problem to create publications and subscriptions on server BUT HOW do I do it on client????? :confused:
Microsoft do not write nothing about client side of replication. everyting is SERVER, SERVER,SERVER and SERVER.The Microsoft HOW TO is only How to click forward, its dosen't really explain anything.
Problaby I need some kind of an database on client and subscription to make the replication. :confused:
please help me, I'am almost finished with my project only replication part is over my head :(
if someone can point me to right direction in this issue. I would be greateful. :cool:
I want to use xp_sendmail against a database other than the master. When I run a test using the master database, it sends a test message w/no problems. However when I try to use xp_sendmail against a database I've created, it gives me an error stating:
Server: Msg 2812, Level 16, State 62, Line 1 Could not find stored procedure 'xp_sendmail'.
How can I use xp_sendmail using a dabase other than Master?? Please Help.
I am using this query to create a single transactions from data that is distributed over several databases. So essentially i have created several variable tables and now I have to join them together. So what I wanted to have happen was display all rows from temptalbel and then join the other tables to create one transaction row. The problem that occurs is within the where statement and I dont understand why. In some cases, you can have two instances of x but y will be different. In that case the joins work perfectly. In the event that there are only a single instance of x associated with a single instance of y this join does not work. Can anyone help me understand why this is happening?
select somedata, somedata, somedata, somedata From kpi..temptablel l left outer join @temps s on l.x = s.x left outer join @tempf f on l.x = f.x left outer join kpi..temptablee e on l.x = e.x left outer join @tempn n on l.x = n.x
where l.y = s.y and l.y = f.y and l.y = e.y and l.y = n.y
hi im a little bit confused. are the two pieces of code similar? what are the differences. i really need to know that coz i wont get access to a SQL machine until monday.
selectlastname fromemp wheresex = 'F' and salary>(selectavg(salary) fromemp group by sex havingsex='M')
selectlastname fromemp wheresex = 'F' and salary>(selectavg(salary) fromemp wheresex='M')
also is it wise to use Group by and having in sub-queries?
Hi I have an slq Express mdf at path X and I copy it to path Y. When I open it up (from the Y path) using sql mgmt studio, it shows that it's from path X. Why? How can I get sql mgmt studio to recognize it as a separate mdf, distinct from the one at path X?
I'm trying to learn how to make and use aliases for two tables in inthis update statement:ALTER PROCEDURE dbo.UpdateStatusAS UPDATE dbo.npfieldsSET Status = N'DROPPED'FROM dbo.npfields NPF, dbo.importparsed IMPLEFT JOIN IMPON (NPF.pkey = IMP.pkey)WHERE (IMP.pkey IS NULL) AND((NPF.Status = N'ERR1') OR (NPF.Status = N'ERR2') OR (NPF.Status =N'ERR3'))I thought I could define the aliases in the FROM statement.I'm using Access as a front end to SQL server if that makes adifference in the queries.