Multiple Concurrent Sql Exec Commands?

Mar 12, 2008

I was wondering if it was possible to run 2 queries at the same time,
IE rather than running
exec query1  
exec query2
and having to wait for query1 to finish before query2 started, just have them run at the same time (they're not conflicting).
I want to do this in TSQL, not by opening another query window in vs2005. 

View 2 Replies


ADVERTISEMENT

Concurrent Insert And Update Commands

Mar 20, 2006

Hi there,

I've had a look at this thread - http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=104399&SiteID=1 - but it's a bit old so I thought I'd try to clarify a couple of things.

I have a data flow which inserts or updates a table in a SQL 2000 database.

The insert is done via an OLE DB destination and the update is done via an OLE DB Command.

As stated in the previous thread, when these commands run concurrently issues arise with blocking etc.

The only way I've managed to get around it is by setting the access mode of the insert to OpenRowset.

So 2 questions:

1) Does anyone know how this problem occurrs and what the best way to get around it is?

2) Are there issues around NOT using the fast load options - I've read stuff about the double-byte character set etc but I admit I don't quite understand it.

Thanks.

View 2 Replies View Related

Problem With Concurrent Insert And Update Commands

Oct 7, 2005

I've got a quite simple data task.

View 13 Replies View Related

Multiple SQL Commands At Once

Jan 8, 2006

I'm running asp.net 2.0 and acessing MSSQL 2K.  I am trying to run a query in which I need to set up variables first.  I tried the following group of commands as shown, passing it to the  SqlDataReader object, but it failed.. does anyone know how i can pass multiple SQL commands?         MainQuery = "declare @MinGrades as Table(GradeID Bigint) " & _                    " INSERT @MinGrades SELECT MIN(CreditGrades.SplitID) AS Expr1" & _                       "  FROM          CreditGrades INNER JOIN" & _                        "    CreditGradeSplits ON CreditGradeSplits.CreditGradeSplitID = CreditGrades.SplitID " & _                        " WHERE      (CreditGrades.x0x30 = - 1 OR " & _                        "    CreditGrades.x0x30 >= 0) AND (CreditGrades.x1x30 = - 1 OR " & _                        "    CreditGrades.x1x30 >= 0) AND (CreditGrades.x2x30 = - 1 OR " & _                        "    CreditGrades.x2x30 >= 0) AND (CreditGrades.x3x30 = - 1 OR " & _                        "    CreditGrades.x3xNOD >= 0) " & _                        " GROUP BY CreditGradeSplits.CreditGradeGroupID" & _                    " Select * from @MinGrades "

View 2 Replies View Related

Integrity With Multiple Commands

Aug 10, 2006

How can I make sure that a couple of commands are either all executed on the database or none of them. For example right now I have an insert, update and delete command. I'm calling each of them with a SqlCommand. So I am afraid that that one of them might be executed, then there's a bad connection and the other two are not. How can I prevent this so that only all commands or nothing is executed on the database?

View 2 Replies View Related

Problems With Multiple Commands Using Views

Jan 10, 2008

I am new to SQL, so I appologize if I am doing something wrong which is really basic.
I am receiving a "Incorrect syntax near ';' " when trying to create a view and then perform action based upon the results
Here is my basic code...the error is on the ; following the create view statement:
create view temp2 as select * from history where crc='XL' and processed<1;
insert into history2 (dialid, calldatetime, origcalldate, crc, revenue, projectid, agentid, phonenum)select  temp2.dialid, temp2.calldatetime, temp2.calldatetime, 'XL', 0, history2.projectid, temp2.agentid, temp2.phonenum from temp2, history2where temp2.dialid=history2.dialid and temp2.crc='XL' and temp2.processed<1 and temp2.projectid=110;
What am I doing wrong???
 Thanks for your help.

View 5 Replies View Related

Execute Multiple Sql Commands With One Trip To The Database.

Jun 12, 2007

Ive got a List<sqlCommand> and I want to execute all the commands in it, but only using one trip to the database. I dont need any return values from any of these commands. Most of the commands are update/insert/delete. Sometimes after a insert command there may be a command "set @NEWID =identity_insert"  to facilitate the next insert to a related table, but thats the only other type of command to insert/update/delete.I am using microsofts enterprise data application block. I want to execute all the commands in the list with just one trip to the database. Would the following code achieve this : db = DatabaseFactory.CreateDatabase("wlmAdmin"); foreach (SqlCommand sc in saveCommands)            {                db.ExecuteNonQuery(sc);            }or would this make multiple trips to the database? Im not 100% on whats going on behind the db object. If I create the db Item in the constructor of my class using "db = DatabaseFactory.CreateDatabase("wlmAdmin");" would this mean that every instance of that class would maintain an open database connection throughout its scope/lifetime?Ive created the class to retrieve all data using a single stored procedure and then when saving, the class builds a List of SqlCommands which as Ive mentioned I want to execute in one trip, to make the number of trips to the database as small as possible. Because of this I don't need the db object maintain an open connection to the database all the time. However It doesnt seem to have any dispose methods so Im not clear on how it operates.In the case that the code above opens a connection for each command, how would I got about batch executing the queries in one trip?Thanks,C    

View 12 Replies View Related

Running Multiple Commands On Single Button Click

Feb 21, 2008

I have a form that contains data that some of which needs to be inserted into one table and the rest updated to another table. I want this to happen on a single button click. Is this possible?Here's what I have so far:            String id = parm_tb_tktid.Text;            String update = parm_tb_desc.Text;            String status = parm_cb_status.Text;                     SqlCommand cmd = new SqlCommand("Insert into History (tkt_id, hist_desc) values(@parm_tb_tktid, @parm_tb_desc)", HelpdeskConnectionString);            cmd.CommandType = CommandType.Text;            cmd.Parameters.AddWithValue("@parm_tb_tktid", id);            cmd.Parameters.AddWithValue("@parm_tb_desc", update);                        SqlCommand cmd1 = new SqlCommand("Update Ticket (tkt_status) values(@parm_cb_status) where tkt_id = @parm_tb_tktid)", HelpdeskConnectionString);            cmd1.CommandType = CommandType.Text;            cmd1.Parameters.AddWithValue("@parm_cb_status", status);            HelpdeskConnectionString.Open();            cmd.ExecuteNonQuery();            cmd1.ExecuteNonQuery();            HelpdeskConnectionString.Close();            parm_tb_tktid.Text = String.Empty;            parm_tb_desc.Text = String.Empty;            parm_cb_status.Text = String.Empty;I know it isn't right, but I can't find any info on why it's wrong and how to code it properly.  

View 9 Replies View Related

What Is Going On Here? SQL Commands And ODBC Commands Aren't Compatible

Oct 1, 2004

I'm building a simple webform, except Visual Studio and my service provider have combined to drive me nutty.

First, I MUST use an ODBC connection to my remote SQL Server do to some unknown configuartion problem. I've been playing with Visual Studio for only a month, so normally when something goes wrong I can go look in the mirror and find the culprit. This is different. I've got a totally functional web form with a SQL Connection, but when I try to change it to an ODBC Connection, I get the following error.

An OdbcParameter with ParameterName '@CertHolder' is not contained by this OdbcParameterCollection

My coding is fine because I stole it straight from the walkthrough and it works. But the specifications that Visual Studio provide are quite suspect. Please note the failure to include some key "@" signs.


#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection
Me.cmdUpdate = New System.Data.SqlClient.SqlCommand
Me.cmdGetAll = New System.Data.SqlClient.SqlCommand
Me.cmdSelect = New System.Data.SqlClient.SqlCommand
Me.OdbcConnection1 = New System.Data.Odbc.OdbcConnection
Me.OdbcGetAll = New System.Data.Odbc.OdbcCommand
Me.OdbcSelect = New System.Data.Odbc.OdbcCommand
Me.OdbcUpdate = New System.Data.Odbc.OdbcCommand
'
'SqlConnection1
'
Me.SqlConnection1.ConnectionString = "this works fine"
'
'cmdUpdate
'
Me.cmdUpdate.CommandText = "UPDATE InsuranceData SET Name = @Name, Address = @Address, Address2 = @Address2, " & _
"City = @City, State = @State, Zip = @Zip, CertHolder = WHERE (CertHolder = @Cert" & _
"Holder)"
Me.cmdUpdate.Connection = Me.SqlConnection1
Me.cmdUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Name", System.Data.SqlDbType.NVarChar, 50, "Name"))
Me.cmdUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Address", System.Data.SqlDbType.NVarChar, 50, "Address"))
Me.cmdUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Address2", System.Data.SqlDbType.NVarChar, 50, "Address2"))
Me.cmdUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@City", System.Data.SqlDbType.NVarChar, 50, "City"))
Me.cmdUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@State", System.Data.SqlDbType.NVarChar, 50, "State"))
Me.cmdUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Zip", System.Data.SqlDbType.NVarChar, 50, "Zip"))
Me.cmdUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@CertHolder", System.Data.SqlDbType.NVarChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "CertHolder", System.Data.DataRowVersion.Original, Nothing))
'
'cmdGetAll
'
Me.cmdGetAll.CommandText = "SELECT CertHolder, Name, Address, Address2, City, State, Zip FROM InsuranceData"
Me.cmdGetAll.Connection = Me.SqlConnection1
'
'cmdSelect
'
Me.cmdSelect.CommandText = "SELECT CertHolder, Name, Address, Address2, City, State, Zip FROM InsuranceData W" & _
"HERE (CertHolder = @CertHolder)"
Me.cmdSelect.Connection = Me.SqlConnection1
Me.cmdSelect.Parameters.Add(New System.Data.SqlClient.SqlParameter("@CertHolder", System.Data.SqlDbType.NVarChar, 50, "CertHolder"))
'
'OdbcConnection1
'
Me.OdbcConnection1.ConnectionString = "This works fine"
'
'OdbcGetAll
'
Me.OdbcGetAll.CommandText = "SELECT CertHolder, Name, Address, Address2, City, State, Zip FROM InsuranceData"
Me.OdbcGetAll.Connection = Me.OdbcConnection1
'
'OdbcSelect
'
Me.OdbcSelect.CommandText = "SELECT CertHolder, Name, Address, Address2, City, State, Zip FROM InsuranceData W" & _
"HERE CertHolder = @CertHolder"
Me.OdbcSelect.Connection = Me.OdbcConnection1
Me.OdbcSelect.Parameters.Add(New System.Data.Odbc.OdbcParameter("CertHolder", System.Data.Odbc.OdbcType.NVarChar, 50, "CertHolder"))
'
'OdbcUpdate
'
Me.OdbcUpdate.CommandText = "UPDATE InsuranceData SET Name = @Name, Address = @Address, Address2 = @Address2, " & _
"City = @City, State = @State, Zip = @Zip WHERE CertHolder = @CertHolder"
Me.OdbcUpdate.Connection = Me.OdbcConnection1
Me.OdbcUpdate.Parameters.Add(New System.Data.Odbc.OdbcParameter("Name", System.Data.Odbc.OdbcType.NVarChar, 50, "Name"))
Me.OdbcUpdate.Parameters.Add(New System.Data.Odbc.OdbcParameter("Address", System.Data.Odbc.OdbcType.NVarChar, 50, "Address"))
Me.OdbcUpdate.Parameters.Add(New System.Data.Odbc.OdbcParameter("Address2", System.Data.Odbc.OdbcType.NVarChar, 50, "Address2"))
Me.OdbcUpdate.Parameters.Add(New System.Data.Odbc.OdbcParameter("City", System.Data.Odbc.OdbcType.NVarChar, 50, "City"))
Me.OdbcUpdate.Parameters.Add(New System.Data.Odbc.OdbcParameter("State", System.Data.Odbc.OdbcType.NVarChar, 50, "State"))
Me.OdbcUpdate.Parameters.Add(New System.Data.Odbc.OdbcParameter("Zip", System.Data.Odbc.OdbcType.NVarChar, 50, "Zip"))
Me.OdbcUpdate.Parameters.Add(New System.Data.Odbc.OdbcParameter("Original_CertHolder", System.Data.Odbc.OdbcType.NVarChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "CertHolder", System.Data.DataRowVersion.Original, Nothing))

I NEVER EVER TYPED ORIGINAL_CERTHOLDER IN THE SQL PREPARATION

End Sub
Protected WithEvents btnSave As System.Web.UI.WebControls.Button
Protected WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection
Protected WithEvents ddlCertHolder As System.Web.UI.WebControls.DropDownList
Protected WithEvents txtName As System.Web.UI.WebControls.TextBox
Protected WithEvents txtAddress As System.Web.UI.WebControls.TextBox
Protected WithEvents ddlCH As System.Web.UI.WebControls.DropDownList
Protected WithEvents cmdUpdate As System.Data.SqlClient.SqlCommand
Protected WithEvents cmdGetAll As System.Data.SqlClient.SqlCommand
Protected WithEvents cmdSelect As System.Data.SqlClient.SqlCommand
Protected WithEvents txtAddress2 As System.Web.UI.WebControls.TextBox
Protected WithEvents txtCity As System.Web.UI.WebControls.TextBox
Protected WithEvents txtState As System.Web.UI.WebControls.TextBox
Protected WithEvents txtZip As System.Web.UI.WebControls.TextBox
Protected WithEvents OdbcConnection1 As System.Data.Odbc.OdbcConnection
Protected WithEvents OdbcGetAll As System.Data.Odbc.OdbcCommand
Protected WithEvents OdbcSelect As System.Data.Odbc.OdbcCommand
Protected WithEvents OdbcUpdate As System.Data.Odbc.OdbcCommand

'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region


Comments? Suggestions, I am not positive about how to fix this.

View 2 Replies View Related

Exec Storeprocedure - Multiple Joins

May 5, 2008

Hi,I am written a store procedure that would access four tables and grab appropriate fields.. I am using JOIN functionality because it can have multiple rows. ( The goal is: )Step 1: User can search by ID  or MEMBER_ID or both .. grab all the data from mainTable based on the search. WORKS.Step 2: TABLE 2 (userTable table) get EMAIL for each record that was grabbed.. based on the ID. WORKS.Step 3: TABLE 3 and TABLE 4.. I am having some problems combing into the query.. how to add multiple JOINS… Is it safe? Please see below what data needs to be combined into the query.--Code works for Step 1 and 2.declare @ID varchar(20), @MEMBER_ID varchar(20) set @ID= null --testing data.. set @MEMBER_ID ='15552' –testing data.. Select MainTable.REFNO,MainTable.ID,mainTable.MEMBER_ID,userTable.EMAILFROM mainTableLEFT JOIN userTableON mainTable.ID = userTable.IDWhere (mainTable.ID = @ID  OR @ID IS NULL) and(mainTable.MEMBER_ID = @MEMBER_ID OR @MEMBER_ID IS NULL)TABLE 3:  (works by itself)SELECT  SR.COMPANY, SR.LOCATION_NOFROM    SI INNER JOIN  SR ON      SI.SR_ID = SR.SR_IDWHERE   SI.ID = MainTable.ID)ORDER BY SR.DATE_RECEIVED DESCTABLE 4:  (works by itself)I will be retrieving LOCATION_NO from SR table and comparing the value to the below query: for each record that was found in  the mainTable.select LOCATION_NAME from locationwhere LOCATION_NO= SR.LOCATION_NO       Please help me solve this.. Thank you  

View 5 Replies View Related

Exec Multiple Batches (GO) With Dynamic Sql

Jun 10, 2008

Hello SQL Team!
I'm stuck at this problem for days and need help.
The problem is with the GO keyword. I know the GO causes the batch to get executed and all local variables are lost. But I can't seem to find a work around. I would like each stored procedure to get executed in different batches.

create table sql_cmd(cmd nvarchar(255))
insert into sql_cmd(cmd) values('exec user_sp param1,''param2'')
insert into sql_cmd(cmd) values('exec user_sp2 param1,''param2'')

declare @sql nvarchar(255)
declare c_sql cursor --small table peformance not a problem. Also open to other suggestions
for select cmd from sqlcmd
open c_sql
fetch next from c_sql
into @sql
while @@fetch_status = 0
begin
print @sql
exec sp_executesql @sql
GO
fetch next from c_sql
into @sql
end

View 4 Replies View Related

Join Results From Multiple EXEC Calls

Apr 25, 2006

I would like to make inner join with results from different exec %procedureName% calls.

thanks.

View 3 Replies View Related

Can Exec Select But Can't Exec Sp

Oct 31, 2007

I have two SQL Server 2000 (one is localhost, one is remote with VPN IP 192.168.5.4).

I can select * from [192.168.5.4].db.dbo.test but I can't exec [192.168.5.4].db..spAdd in localhost.

These select and sp is OK for 1 or 2 week without any problem,but it didn't work one day.

Can some one explain why?

View 5 Replies View Related

25 Concurrent Connections

Mar 16, 2004

Hey,

MSDE 2000 allows 25 concurrent connections.

If these are all used up, and a 26th connection comes in. What happens? is the connection rejected? or does it sit in a queue, waiting to be given a connection?

Thanks,
-Ashleigh

View 2 Replies View Related

Ms-sql 7 Concurrent Connections

May 8, 2002

hi
i hv developed an application that runs on the local windows system and interfaces with the MSSQL 7.0 database server using ODBC DSN Connections. This application will be deployed over the LAN with over 100 users.

The MSSQL 7.0 server has only 5 user licenses that limits the concurrent usage to 5 users.

I need a solution whereby all users can access the SQL server database without adding more licenses

Is there a way out.

Please help

Regards
JD

View 2 Replies View Related

Concurrent Connections

Nov 30, 2007

Morning

I have been searching hi and low on the web to try and find out typically which version of sql server should be used based on the number of concurrent users you will be having.

I believe that Sql Server 2005 Express should only really be used for up to 10 concurrent users while I seem to remember that Standard edition supports up to approx. 33,000 connections.

Does anybody have this information to hand as I need to write a business case to justify the potential upgrade.

Many thanks

James

View 3 Replies View Related

Concurrent Users

Dec 16, 2005

Hi,Is it possible to have many different clients conncecting to a web basedserver all using, simultaneously, the same DSN-less connection string heldin a server side include file?Many thanksRay Allison

View 2 Replies View Related

Concurrent Run Of A Package

Feb 29, 2008

what happens when a package is run concurrently by 2 or more users. will the flow be in a queue, if not how is it going to be.

Thanks .

View 11 Replies View Related

Control Concurrent Users?

Aug 24, 2006

    is it possible to limit the concurrent users in SQL connection string? Now, i m using .net 2003.regards,

View 3 Replies View Related

MDSE Concurrent Connections.

Nov 6, 2003

hey all,

MSDE will only allow 5 concurrent connections to ...

a particular database?
a particular instance?
or a particular server?

ie. if i have one application running on one instance of MSDE with 5 connections and i have another application running on another instance of MSDE with 5 connections. would i actually have 10 connections? **both instances on the same machine...

can someone please clarify.

TIA

Chris

View 2 Replies View Related

MS Access Concurrent Users

Nov 7, 2000

Hi,

Does anyone know is MS Access has any limited no of users, or how many concurrent users MS Access has?

Thanks

View 2 Replies View Related

Concurrent Users...URGENT!!

Jul 20, 2000

I need to know how many concurrent users are allowed to access the database at any point of time.Will it depend on the type of licence?Where do we set this parameter.Some users are complaining 'time out' problem.Thanks for any help!

View 1 Replies View Related

Concurrent User Information

Nov 29, 2007

dear folks,

Does anyone know how can I get concurrent user information on Microsoft SQL Server 2000/2005….?

Thanks

cheers
sbahri

View 2 Replies View Related

Concurrent Stored Procs?

Mar 8, 2004

Hi all

I have a stored proc that runs every 4 hours - as a job. The stored proc takes about 3-5 minutes to comple, depending on number of records.
To do testing we run that stored proc manually, also.
Sometimes 2 or more people may run the same stored proc without knowing that the other person is running. This may create duplicates entries once processed.

What I want to know is, Is there a way to check if that stored procedure is currently running. If so it wont run second time concurrently.
(May be semapohres,mutex or something like that?)

(I am trying not to use a table to store whether the stored proc is running or not)


Thanks in advance.

Rochana

View 10 Replies View Related

Concurrent Queries Error

Jul 23, 2005

On my server running SQL Server 2000 (SP3). I frequently get thisinformational message in the Event Viewer log.17052 :This SQL Server has been optimized for 8 concurrent queries. This limit hasbeen exceeded by 2 queries and performance may be adversely affected.The application that I am running is a vendor application so I do not haveaccess to the code. I contacted the vendor, but they have never seen thisproblem and cannot recreate it. I checked the Microsoft Knowledge Base forhelp, but I came up empty. It seems like it should be a simpleconfiguration change.Any advice?Thanks,Jeff

View 1 Replies View Related

Technique For Concurrent Access?

Jul 20, 2005

I've been asked to turn our single-user database system into a multi-usersystem. At present, each user has a copy of the MSDE on their desktopmachine and uses our program to access it. In future, we would like tocentralise our MSDE instance and allow multiple users to access it. Inorder to facilitate this, we are going to only allow one user write accessto the system at a time (I know, its a kludge, but the system was neverdesigned for multiple users in the first place).I have a single, simple question this being the case: can I update a single"read-only" bit field in a table of the database in order to flag to otherusers that the system is in read-only mode in a way that avoids concurrencyissues? ie. does an "UPDATE" query lock and unlock? ( I suspect the answeris yes! ). If anyone else has experience of these things, I would alsoappreciate some tips on how best to proceed.ThanksRobin

View 7 Replies View Related

Concurrent Connection Limits

Jul 25, 2007

I'm new using SQL 2005 Express

I'm planning to use SQL Server Express 2005 for a asp net web application for a video rental store.

Is there a concurrent user conection limit that I should care?



TIA

Gerardo

View 1 Replies View Related

Puzzled By Concurrent Update

May 6, 2006

I have a puzzle in my mind here. I will thank anyone who can solve my puzzle.

I am not familiar with SQL and its theories behind, so please bear with me if I am asking a stupid newbie question.

My puzzle is generally a problem of generating sequence numbers. The following SQL is only a stripped down version - it fetches the max number, add 1 to it and updates the table with the new number.

DECLARE @max int

SELECT @max = MAX(next_number) + 1 from sequence_numbers

UPDATE sequence_numbers SET next_number = @max WHERE next_number = @max

Now if user1 gets 100 and user2 also gets 100 and they both try to update the table, what would happen? I fear that the result would be 101.

One of my coworker thinks that adding 'WHERE next_number = @max' can solve the conflict - user2 will fail. His reasoning is like this:

After user1 updates the table, next_number would be 101 and user2's update will fail because his WHERE criteria is still 100.

But I think user2 still sees the old data (100) and still succeeds and thus both users update the table with number 101.

Thanks.

 

View 10 Replies View Related

Number Of Concurrent Users

Apr 13, 2006

Hello,

There was a 5 concurrent user limitation in MSDE (the version prior to SQL Express). Does that same limitation exist with SQL Express 2005?

Thanks.

View 3 Replies View Related

Group By Concurrent Years

Nov 8, 2007



Hi and thank you in advance to whomever takes the time to read this entry. I will be as detailed as possible, so I apologize for the length. The information here relates to the automotive industry, but I don't believe that is a very important detail

The overall purpose of this query is to create a compressed set of the data that exists in the database. The de-normalized information is structured like the following (including made-up data):




Code Block
PartNumber Make Model Year
-------------------------------------------------------
835100 ACURA INTEGRA 2004
835100 ACURA INTEGRA 2003
835100 ACURA INTEGRA 2001
835100 ACURA INTEGRA 2000
835100 FORD FOCUS 2002





There is any number of part numbers, makes, etc in this mix. The query that I currently use is utilizing MAX and MIN functions to determine year range, but as in the sample above, this does not take into account the fact that there could be a year skipped in the middle. I could probably use a cursor to do this, but would really like to stick to set logic if at all possible.


My existing query is:




Code Block
SELECT DISTINCT
cwi.PartNumber
,RTRIM(lv.Make) AS Make
,MIN(lv.Year) AS StartYear
,MAX(lv.Year) AS EndYear
FROM
CWIParts AS cwi
INNER JOIN PartTypes AS pt
ON cwi.PartTypeID = pt.PartTypeID
INNER JOIN PartDetail AS pd
ON cwi.PartNumber = pd.PartNumber
INNER JOIN Status AS s
ON pd.StatusCode = s.StatusCode
INNER JOIN LegacyVehicle AS lv
ON cwi.LegacyVehicleID = lv.LegacyVehicleID
WHERE
cwi.PartTypeID = 10
AND s.Status = 'Active'
GROUP BY
lv.Make
ORDER BY
cwi.PartNumber ASC
,cwi.Make ASC





In hopes to end up with a result set that has 1 row for each unique part-number, make, and consecutive year range relevant to the part-number and make. I will also need to add the functionality to add other attributes (such as Model and Liters), but those are equality based and can be passed in easily.


I had done most of this programatically in vb.net, but I would much rather push this logic back to SQL Server. Thank you all for any help that you can provide on this topic.

- Jay Soares

View 9 Replies View Related

Concurrent Connections Limit

May 18, 2008



Hi,
I read that there's a "tecnical" limit of 32767 concurrent connections for SQL 2005 Express, and that SQL 2005 Express uses only 1GB of memory. So, what's the number of practical concurrent connections SQL 2005 Express can handle? Is it 200 ,300, 0r 400...? How much memory is consumed by every connection?
Thanks in Advance.

View 10 Replies View Related

Change Number Of Concurrent Connections

Oct 22, 1999

Does anyone know how to change the number of conccurent connections on SQL Server 7. We have purchased 10 additional licenses and I need to change the concurrent users from 10 to 20. Any help would be appreciated. Thanks

Phil

View 2 Replies View Related

Database Concurrent Access Issue

May 22, 2007

Dear All,

I have this .NET application that inserts lucky draw entries into SQL server. Each entry may have a range of values that the winning number will be drawn from. For example,

Entry 1: [1, 2]
Entry 2: [3, 8]
Entry 3: [9, 10]
Entry 4: [11, 11]
Entry 5: [12, 20]

The winning number will be picked from [1, 20]. Given this scenario, what is the best design that can handle the concurrency issue? If two entries are input at the same time, how to make sure it won't have the same starting value? Anyway to lock a table when one is accessing, disallowing other to run select query?

Thanks.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved