I'd like to select all metal types, and the weight of any metal that has a matching record for a given object ID. So for ObjectID 1, I want a result set like this:
I've tried a left outer join on the assigned metals table, but only got the one matching record back. Also if possible, the ideal result would also indicate if it had a match:
I have created a a web application on computer1 and I have now transferred it to computer2. I am trying to attach my database (db1) in VS but I get this error: "Cannot open user default database. Login failed for user: username1". However when I use Management Studio Express I am able to access db1. I'm a newbie on this.
Hey guys, I am a newbie here, so please bear with me. I have installed SQL Server 2005 CTP on Machine A and MSDE on Machine B. Both these contain the PUBS database beside others. On Machine C, I have installed "ASP.Net Web Matrix" and I want to be able to connect to either Machine A or B to access the PUBS database. It connects to Machine B, when I put in the Servers IP address. But everytime I try to connect to Machine A, it gives me an error saying, "Unable to connect to the database. To connect to this server you must use SQL Server Management Studio or SQL Server Management objects(SMO) ". I heard that connection strings are needed to access the SQL Server 2005 but I have no idea where to begin. Do I need to create special users to access the Server or will Windows authentication work ? Could anyone help me out in connecting to the SQL Server 2005 CTP?
I am trying to transfer data into SQL Server from Excel using DTS.
I get error for a particular field:
Data for Source Column 3('Col3') is too large for the specified buffer size.
I gathered from other resources, that this error is due to some record in the excel sheet for which that particular field is too big. and it reads only the first 8 records to determine a data type.
the fix is to chnage the registry value, as mentioned in the above link. But hat is not an option for me, as that slows down the process a lot.
Does any body else has any other suggestion for this?
I have an idea, that worked, but for that I have to manually insert a record on the top in the excel sheet, with a big size data in that field (which gives problem), and then run DTS, later delete that record.
To automate this idea, I tried to do a DTS from a dummy table (with a record with big data in it) to this excel sheet, but it puts the record at the bottom of the sheet. Is there any way to put this record on the top?
Any help in this regard will be greatly appreciated.
I installed SqlExpress with Advanced services on to a server running Small Business server 2003.
I needed to uninstall SqlExp, and thought I did so through Add/Remove programs. For some reason it did not seem to uninstall. Foolishly I did not check, and then tried to install another copy in a different directory. I've then ended up with complete mess.
Tried to do another uninstall, but again, ended up with two incomplete versions of express.
Is it possible that part of my problem revolves around the fact I have a mirrored drive with Raid 1 installed.??
Whatever, I need to know how to clean up the mess and start again. Preferably without having to do a format and reinstall SBS.
We are using a system that has uses four instances. On each client to the server we used the ODBC settings to connect to the different instances. We have since reinstalled the server, and now we are unable to find or 'see' any of the databases, except for locally.
E.g. The first database we install is named Foo, with database Bar. It is set up on port 1433. The second named instance is Foo2, with database Bar2. It is set up on a dynamic port.
We now try to connect to the database with ODBC. We connect to SERVERFOO, and then select the BAR db. It works fine. We then try to connect to the database SERVERFoo2, it lets us in, and then all we can select is the BAR db. I don't know what is causing this. We never before had to edit the settings in the client config for the odbc settings (e.g. to set manually to TCP port 1433) and I have checked the sql config manager to ensure that tcpip settings are allowed and will "ListenAll".
What more do we need to do? I think the browser should be installed, but my collegue disagrees.
Any ideas as to why we can only see the database referenced to 1433 port, and why no other port works, when we never had to do that before?
Hello frdz, I have two tables in sqlserver 2005. I have created the stored procedure for insert,update data.I m creating my application in asp.net with C# Table-1 CUSTOMERFields:customerid int identity,cardid int,customername varchar(20) not null,address varchar(20) not null,city varchar(20) not null,emailid varchar(20) Table-2 CARDFields:cardid int identity,cardtype varchar(20) not null,carddetails varchar(20) not null INSERT INTO CUSTOMER (customername ,address,city,emailid) VALUES (@customername,@address,@city,@emailid) SELECT @customerid = SCOPE_IDENTITY()/* HELP HERE NOT ABLE TO GET DATA OF CARD */ SELECT @cardid = cardid from CARD where customerid =@cardid Pls tell me how to insert the data ...There is only one cardid for only one customerid both should be unique no duplication....One customer can have only one and one card...
I am trying to create stored procedure i Query analyzer in visual studio 2005. I am havingdifficulty though. Whenever I press the execute button, here is the error message I get: Msg 102, Level 15, State 1, Procedure MarketCreate, Line 21Incorrect syntax near 'MarketName'. Here is the stored procedure. Note that the very first column in named "MarketId" but I did notinclude it in the stored procedure since it should be auto generated. USE [StockWatch]GO/****** Object: StoredProcedure [dbo].[MarketCreate] Script Date: 08/28/2007 15:49:26 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGO CREATE PROCEDURE [dbo].[MarketCreate] ( @MarketCode nvarchar(20), @MarketName nvarchar(100), @LastUpdateDate nvarchar(2), @MarketDescription nvarchar(100)) ASINSERT INTO Market( MarketCode MarketName LastUpdateDate MarketDescription)VALUES( @MarketCode @MarketName @LastUpdateUser @MarketDescription)
I created a web form where the user fills in some data and when he submits the form, I do an insert into he database table. The problem is, how can I get the data from the form into the insert statement?. here is the code: Dim Message As String Dim connStr As String Dim myConnection As SqlConnection Dim mySqlCommand As SqlCommand connStr = "server=SIMIVSdotNET;Trusted_Connection=yes;database=AeroSea" myConnection = New SqlConnection(connStr) mySqlCommand = New SqlCommand("INSERT INTO TravelRequestEntry (CustomerID,Name) Values (1,name.text)", myConnection)
If I execute the above code, then nothing gets updated. When I change the insert staement into the following, mySqlCommand = New SqlCommand("INSERT INTO TravelRequestEntry (CustomerID,Name) Values (1,'myname')", myConnection) then, value 1 for customerID field and myname in the namefield is added. I know I am doing something stupid, but can't figure it out. I am confused. please help me.
This is probably a very simple question but i am having problems with inserting information into database The function takes the values "FirstName" And "LastName" from A table Called "Customer" and the value "ProductID" from a table called "Products" and inserts them into a table called " NewOrder". Everything compiles ok but when I press the button the information is not uploaded to thedatabase. ( There is no error message) This is the stored procedure CREATE PROCEDURE SP_NewOrder(@CartID char (36), @CustomerID Varchar (50))AS INSERT INTO NewOrder (FirstName, LastName, ProductID) SELECT Customer.FirstName, Customer.LastName, Products.ProductID From Customer,Products Join ShoppingCart ON Products.ProductID =ShoppingCart.ProductIDWHERE ShoppingCart.CartID = @CartID AND Customer.CustomerID = @CustomerIDGO This is the Function Public Shared Function CreateOrder() AS String Dim customerID As integer Dim connection as New SqlConnection(connectionString) Dim command as New SqlCommand("SP_NewOrder",connection) command.CommandType = CommandType.StoredProcedure command.Parameters.Add("@CartID", SqlDbType.Char,36) command.Parameters("@CartID").Value = shoppingCartID command.Parameters.Add("@CustomerID", SqlDbType.Varchar,36) command.Parameters("@CustomerID").Value = customerID Try connection.Open() command.ExecuteNonQuery() Finally connection.Close() End TryEnd Function This is the page code Sub btn3_Click(sender As Object, e As EventArgs)Dim cart as New ShoppingCart()Dim shoppingCartID As IntegerDim customerID As Integer = Context.Session("worldshop_CustomerID")cart.CreateOrder()End Sub Can Anyone see where I am going wrong Many thanks martin
I'm new to SQL Server and I'm using 2005 Express with SSMSE, and having trouble adding a record to a table "manually" by typing in the data.
I find I can change most of the fields by viewing the table in SSMSE and just clicking on the field and editing it then clicking "execute SQL" but for some reason the changes don't "take" when a date field is involved.
Is there a special or proper way to enter a date that I'm not aware of? I'm not having much success figuring out this online help stuff from within SSMSE, I keep getting to help on the help system itself (oops).
I am probably missing something simple here but...
I have a CLR Stored Procedure where I am attempting to execute multiple SQL commands. Here is what happens.
Case One 1. Stored Procedure is invoked. 2. Create SQL Connection. 3. Open the connection. 4. Begin Transaction. 5. Create Command from Connection. 6. Set Command objects Transaction property to transaction created above. 7. Set Command Text Property to SQL Query. 8. Execute Query via ExecuteReader and get SQLReader. 9. Read query result set. 10. Close QueryReader. 11. Set Command Text Property to another SQL Query. 12. Execute Query
This is where I get one of two exceptions. 1. An Exception stating that I cannot have parallel transactions. or 2. An Exception that I have an open SqlReader that must be closed.
Case Two 1. Stored Procedure is invoked. 2. Create SQL Connection. 3. Open the connection. 4. Begin Transaction. 5. Create Command from Connection. 6. Set Command objects Transaction property to transaction created above. 7. Set Command Text Property to SQL INSERT command. 8. Execute Insert command. 9. Set Command Text Property to SQL Query command. 10. Execute Query Command via ExecuteReader.
At this point the stored procedure appears to hang.
Could someone please enlighten me if I have missed something obvious while reading the manual, regarding what you can and cannot do?
Panicked, as usual. Who says it's great being a sole proprietor?Using MS-SQLServer:Three tables: A_Appointment, AX_Appointment_Entity and E_Entity.AX_Appointment_Entity is an intersect/association table betweenA_Appointment and E_Entity. One appointment may have many attendees(Appointment_Entity). One attendee (Entity) may have manyappointments.My task is to delete all appointments and relatedAX_Appointment_Entity rows where the number of attendees is one orless.I'm great at standard select or delete queries. Because this straddlestables in a way I'm less skilled in, I'm pleading for help.Thanks for any ideas. fwiw, I'm using Transact-SQL.BLink--------------------------"The worst thing about censorship is [redacted]"
Dear Experts,I've worked with Oracle since 1995. I have gonevery deep into many of the Oracle features, includingsqlloader, and export/import. And I've done datamodelling even longer.At the same time, I have done ETL since 1995.Although, at the Proc, and PLSQL, sqlloader, level.Map the data. Take data from the source, do anymodifications/transformations that are required,and insert or update. Easy. The hard part isdetermining the mappings.But I have not been given the opportunity towork much with ETL tools such as:Informatica, DataStage, Ascential, Ab InitioThe little bit of experience that I do have,showed that Informatica was -incredibly- easy to use.It's a GUI. It's SUPPOSED to be simple!!!I have missed out on a number of opportunitiesbecause I didn't have a few YEARS of experiencewith ETL tools. Which seems odd, because thetool looks like it requires a max of a week to learn!Just how difficult are these ETL tools to learn?Especially if you have already been working withOracle, and doing data mappings and loads since 1995?I'm thinking that it can't be difficult at all.When you search for newsgroups, there are no newsgroupsfor these tools. Although the companies who makethem, might have their own newsgroup.There are also not many books on these tools.If you search for books on Oracle, or SQL Server,you will find a lot of very big, and detailedbooks. But there is next to nothing specificallyon the various ETL tools.Any certifications for any of these tools lookto be much simpler than Oracle's.To me, the real issue is the mappings. If youcome into a new environment, the data mappingsare completely esoteric to those systems.No amount of experience with an ETL tool, or anytool, is going to tell you what the mappings should be.Questions:- Just how difficult are these ETL tools to learnfor an experience Oracle pro like myself?- Other than a GUI, making everything simple to use,just what are the advantages of using ETL tools?- what built in functionality do ETL toolshave, that can't be done in PLSQL?Thanks a lot!
I have been running SQL Server 2005 Express (basic) Instance MSSMLBIZ in conjunction with Microsoft Office Accounting 2007 Professional.
I want to make a "clean install" of SQL Server 2005 Express Advanced, SQL Server2005 Express Tools, in order to create additional Reports in Microsoft Office Accounting 2007 Professional.
I ran uininstall on the basic SQL Server 2005 Express, but Native Client did not uninstall; the following message was posted:
"An installation package for the product Microsoft SQL Native Client cannot be found. Try the installation again using a valid copy of the installation package 'sqlncli.msi'."
I then attempted to install SQL Server 2005 Express Advanced, but it failed to load Native Client. I then uninstalled all instances, deleted the SQL Server Express Files in Programs, and ran "CC Cleaner" to clear the Registry.
I then attempted to uninstall Native Client again, and received the following message:
"This action is only valid for products that are currently installed."
I the returned to CCCleaner Tools to attempt to delete the residuals and received the following message
"Cannot delete msi installer."
I ran "Search - *.msi" and there is no instance of sqlncli.msi visible.
I'm developing an application in VB 2005 Express using SQL 2005 Express. I need to put a timestamp into my table each time I create a row...
The following is a snippet...
Dim DDate As [SqlDateTime] = Now()
Dim TheQuery As String = "INSERT INTO Groups (PC_Name_Stamp, OperatorNo, Group_Type, Date_Time) VALUES ('Development', '2', 'Test',' " & DDate & " ')"
Which won't work as I am attempting to concatinate a SqlDateTime into a string.
My best guess is that I need to somehow to use a DEFAULT value in the table that persists so each time a row is created the datetime it was created is saved with the row, rather than being re-calculated each time the table is opened. There are probably several other ways of doing it and this may not be the easiest.
I'm not a programmer, just an Engineer, so I can only read Help for 5 minutes at a time.
Hi... I am new to MS SQL 2000. I need to generate reports using the SQL2000 database and exporting the data to Excel. Currently i started using the DTS services and was fine..But i have constraints that Excel can hold only 65K records..My records can go up to 80K +.Is there a way i can split the sheet depending the number of records..or is there a better way to do this...I do not have reporting services as we r using SQL 2000...Could anyone please help...
If there is any other way of doing this please guide me as to how to go about or any reference websites...
I have a real installation mess n my hands. I'm attempting to install Sql Server Developer edition on a new Thinkpad with Vista Ultimate. There are no issues with limited resources. This copy of Vista Ultimate came with a trial copy of Office 2007 and SQLExpress was intalled with it. I unistalled SQLExpress being unaware of the Vista Compatibility problems. SQL Developer did not install after I removed SQLE. After researching this on the net, I read that developer could be installed as an upgrade if SQLE is on the system. So Installed SQLE with advanced tools deliberately not installing the tools. That installation went well. So then I tried to reinstall SQL Developer and received a message about having to setup via command line because of an exisiting instance. So I installed Developer with the folowing command line from an MSDN DVD.
I chose the advanced options specifiying that the tools be installed. That installation failed to install the tools and I believe there was an error in the core data engine installation. I received an error message to check the logs but to be honest, there are meagbytes of log files and I don't really know what to check.
The core log looked like this:
Microsoft SQL Server 2005 Setup beginning at Mon Oct 29 11:11:04 2007 Process ID : 4816 E:ENGLISHSQL2005DEVELOPERSQL Server x86Serverssetup.exe Version: 2005.90.1399.0 Running: LoadResourcesAction at: 2007/9/29 11:11:3 Complete: LoadResourcesAction at: 2007/9/29 11:11:3, returned true Running: ParseBootstrapOptionsAction at: 2007/9/29 11:11:3 Loaded DLL:E:ENGLISHSQL2005DEVELOPERSQL Server x86Serversxmlrw.dll Version:2.0.3604.0 Complete: ParseBootstrapOptionsAction at: 2007/9/29 11:11:4, returned true Running: ValidateWinNTAction at: 2007/9/29 11:11:4 Complete: ValidateWinNTAction at: 2007/9/29 11:11:4, returned true Running: ValidateMinOSAction at: 2007/9/29 11:11:4 Complete: ValidateMinOSAction at: 2007/9/29 11:11:4, returned true Running: PerformSCCAction at: 2007/9/29 11:11:4 Complete: PerformSCCAction at: 2007/9/29 11:11:4, returned true Running: ActivateLoggingAction at: 2007/9/29 11:11:4 Complete: ActivateLoggingAction at: 2007/9/29 11:11:4, returned true Running: DetectPatchedBootstrapAction at: 2007/9/29 11:11:4 Complete: DetectPatchedBootstrapAction at: 2007/9/29 11:11:4, returned true Running: LaunchPatchedBootstrapAction at: 2007/9/29 11:11:4 Error: Action "LaunchPatchedBootstrapAction" threw an exception during execution. Error information reported during run: "c:Program FilesMicrosoft SQL Server90Setup Bootstrapsetup.exe" finished and returned: 1706 Aborting queue processing as nested installer has completed Message pump returning: 1706
I believe residual office files are throwing the installation off but that could be an erroneous conclusion as the OWC portion always fails with a 1706.
What I need is basic SQL functionality and it's really important that I have the Studio Management Console.
Does anyone have any suggestions as to what log to check toward getting a core data engine installed along with the olls and documentation for SQL Developer?
I setup the databse and Visual Web Developer to use stored procedures when the insert command is used. The database also uses the field UserName that I pass using a SessionParameter within the InserParameter block from the Membership.GetUser.Username from the aspnet_ tables.
My difficulty is when using the "Formview" as the body to with which to insert (I wanted the design versatility of FormView) I get an error: "system.formatExpression: Input string was not in a correct format" when I leave the textboxes empty and invoke the insert command. I first assumed that the bound textboxes are not being converted correctly when left blank, so I used the ConvertEmptyStringToNull=True, with no success. I then coupled that with the Type=[correct format] still with the same error. Alas, my final attempt was to set defaults in the "ALTER PROCEDURE" within the stored procedure itself.
Hello, Kind of a .Net question, although specifically related to VSA.
We have a script task that references an external DLL. That DLL is a proxy for a web service and it takes its configuration info (e.g. location of the web service) from a configuration file.
We have created a quick-and dirty test harness exe to consume data using the proxy and it works fine. All you need to do is dump the proxy, the config file and the test harness exe into a folder.
This doesn't work so well when you substitute SSIS for the test harness. We are trying to use a script task which references the proxy DLL to get a response from the web service but when we execute we get:
"Cannot find default endpoint element that references contract 'blah blah blah' in the ServiceModel client configuration section. This might be because no configuration file was found for your application..." [See a screenshot here: http://cid-550f681dad532637.skydrive.live.com/self.aspx/Public/Misc/ssis_script_task_config_error.JPG]
This makes sense of course, right? The DLL needs the config file. However, where do you put the config file so that the DLL (which, remember, is running inside SSIS) can find it? We've tried putting it in the same folder as the .dtsx file, in the same folder as dtexec.exe...nothing works.
To try and debug we put the following code into the script task:
Code Snippet Dim rst_Path As String rst_Path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName.CodeBase) MsgBox(rst_Path)
and the resultant message box was contained "file:C:WINDOWSassemblyGAC_MSILMicrosoft_VsaVb8.0.0.0__<GUID>"
which makes complete sense of course.
So, my question is, how can we configure this whole kaboodle of "stuff" so that it works?
Hello,I'm trying to create a simple back up in the SQL Maintenance Plan that willmake a single back up copy of all database every night at 10 pm. I'd likethe previous nights file to be overwritten, so there will be only a singleback up file for each database (tape back up runs every night, so each daysback up will be saved on tape).Every night the maintenance plan makes a back up of all the databases to anew file with a datetime stamp, meaning the previous nights file stillexists. Even when I check "Remove files older than 22 hours" the previousnights file still exists. Is there any way to create a back up file withoutthe date time stamp so it overwrites the previous nights file?Thanks!Rick
I was writing a query using both left outer join and inner join. And the query was ....
SELECT S.companyname AS supplier, S.country,P.productid, P.productname, P.unitprice,C.categoryname FROM Production.Suppliers AS S LEFT OUTER JOIN (Production.Products AS P INNER JOIN Production.Categories AS C
[code]....
However ,the result that i got was correct.But when i did the same query using the left outer join in both the cases
i.e..
SELECT S.companyname AS supplier, S.country,P.productid, P.productname, P.unitprice,C.categoryname FROM Production.Suppliers AS S LEFT OUTER JOIN (Production.Products AS P LEFT OUTER JOIN Production.Categories AS C ON C.categoryid = P.categoryid) ON S.supplierid = P.supplierid WHERE S.country = N'Japan';
The result i got was same,i.e
supplier country productid productname unitprice categorynameSupplier QOVFD Japan 9 Product AOZBW 97.00 Meat/PoultrySupplier QOVFD Japan 10 Product YHXGE 31.00 SeafoodSupplier QOVFD Japan 74 Product BKAZJ 10.00 ProduceSupplier QWUSF Japan 13 Product POXFU 6.00 SeafoodSupplier QWUSF Japan 14 Product PWCJB 23.25 ProduceSupplier QWUSF Japan 15 Product KSZOI 15.50 CondimentsSupplier XYZ Japan NULL NULL NULL NULLSupplier XYZ Japan NULL NULL NULL NULL
and this time also i got the same result.My question is that is there any specific reason to use inner join when join the third table and not the left outer join.
OLEDB source 1 SELECT ... ,[MANUAL DCD ID] <-- this column set to sort order = 1 ... FROM [dbo].[XLSDCI] ORDER BY [MANUAL DCD ID] ASC
OLEDB source 2 SELECT ... ,[Bo Tkt Num] <-- this column set to sort order = 1 ... FROM ....[dbo].[FFFenics] ORDER BY [Bo Tkt Num] ASC
These two tasks are followed immediately by a MERGE JOIN
All columns in source1 are ticked, all column in source2 are ticked, join key is shown above. join type is left outer join (source 1 -> source 2)
result of source1 (..dcd column) ... 4-400-8000119 4-400-8000120 4-400-8000121 4-400-8000122 <--row not joining 4-400-8000123 4-400-8000124 ...
result of source2 (..tkt num column) ... 4-400-1000118 4-400-1000119 4-400-1000120 4-400-1000121 4-400-1000122 <--row not joining 4-400-1000123 4-400-1000124 4-400-1000125 ...
All other rows are joining as expected. Why is it failing for this one row?
I'm having trouble with a multi-table JOIN statement with more than one JOIN statement.
For each order, I need to return the following: CarsID, CarModelName, MakeID, OrderDate, ProductName, Total ordered the Car Category.
The carid (primary key) and carmodelname belong to the Cars table. The makeid and orderdate belong to the OrderDetails table. The productname and carcategory belong to the Product table.
The number of rows returned should be the same as the number of rows in OrderDetails.
Why would I use a left join instead of a inner join when the columns entered within the SELECT command determine what is displayed from the query results?
I have a merge join (full outer join) task in a data flow. The left input comes from a flat file source and then a script transformation which does some custom grouping. The right input comes from an oledb source. The script transformation output is asynchronous (SynchronousInputID=0). The left input has many more rows (200,000+) than the right input (2,500). I run it from VS 2005 by right-click/execute on the data flow task. The merge join remains yellow and the task never finishes. I do see a row count above the flat file destination that reaches a certain number and seems to get stuck there. When I test with a smaller file on the left it works OK. Any suggestions?
A piece of software I wrote starting timing out on a query that left outer joins a table to a view. Both the table and view have approximately the same number of rows (about 170000).
The table has 2 very similar columns, one is a varchar(1) and another is varchar(100). Neither are included in any index and beyond the size difference, the columns have the same properties. One of the employees here uses the varchar(1) column (called miscsearch) to tag large sets of rows to perform some action on. In this case, he had set 9000 rows miscsearch value to "g". The query then should join the table and view for all rows where miscsearch is set to g in the table. This query takes at least 20 minutes to run (I stopped it at this point).
If I remove the "where" clause and join all rows in the two tables, the query completes in about 20 seconds. If set the varchar(100) column (called descrip) to "g" for the same rows set via miscsearch, the query completes in about 20 seconds.
If I force the join type to a hash join, the query completes using miscsearch in about 30 seconds.
So, this works:
SELECT di.File_No, prevPlacements, balance,'NOT PLACED' as status FROM Info di LEFT OUTER HASH JOIN View_PP pp ON di.ram_file_no = pp.file_no WHERE miscsearch = 'g' ORDER BY balance DESC
and this works:
SELECT di.File_No, prevPlacements, balance,'NOT PLACED' as status FROM Info di LEFT OUTER JOIN View_PP pp ON di.ram_file_no = pp.file_no WHERE descrip = 'g' ORDER BY balance DESC
But this does't:
SELECT di.File_No, prevPlacements, balance,'NOT PLACED' as status FROM Info di LEFT OUTER JOIN View_PP pp ON di.ram_file_no = pp.file_no WHERE miscsearch = 'g' ORDER BY balance DESC
What should I be looking for here to understand why this is happening?
We are trying to migrate from sql 2005 to 2012. I am changing one of the implicit join to explicit join. As soon as I change the join, the number of rows returned are fewer than before.
INSERT #RIF_TEMP1 (rf1_row_no,rf1_rif, rf1_key_id_no, rf1_last_date, rf1_start_date) SELECT currow.rf0_row_no, currow.rf0_rif, currow.rf0_key_id_no, prevrow.rf0_start_date, currow.rf0_start_date FROM #RIF_TEMP0 currow LEFT JOIN #RIF_TEMP0 prevrow ON (currow.rf0_row_no = prevrow.rf0_row_no + 1)
[Code] ....
the count returned from both the queries is different.
I am not sure what am I doing wrong. The count of #RIF_TEMP0 is always 32, it never changes, but the variable @countTemp is different for both the queries.