From jwcolby at colbyconsulting.com Mon May 2 15:27:21 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Mon, 02 May 2011 16:27:21 -0400 Subject: [dba-SQLServer] SQL Server - Append records without fail Message-ID: <4DBF13A9.9080503@colbyconsulting.com> In access you can append records into a table and if a given record fails, the rest go in. I use that as a quick and dirty filter sometimes when (for example) appending records from one place to another. AFAICT SQL Server will not append any of the records if any single record fails to append, which has always seemed strange to me. It's almost like an unrequested rollback. Is there any way to make SQL Server accept the appends that will go in and only reject the ones that will not for some reason? -- John W. Colby www.ColbyConsulting.com From ab-mi at post3.tele.dk Mon May 2 16:18:36 2011 From: ab-mi at post3.tele.dk (Asger Blond) Date: Mon, 2 May 2011 23:18:36 +0200 Subject: [dba-SQLServer] SQL Server - Append records without fail In-Reply-To: <4DBF13A9.9080503@colbyconsulting.com> References: <4DBF13A9.9080503@colbyconsulting.com> Message-ID: <71345C412B464389BAD067771E90DB06@abpc> John, If the unique index is created with the option IGNORE_DUP_KEY then the behaviour will be the same as in Access. Asger -----Oprindelig meddelelse----- Fra: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] P? vegne af jwcolby Sendt: 2. maj 2011 22:27 Til: Access Developers discussion and problem solving; Sqlserver-Dba Emne: [dba-SQLServer] SQL Server - Append records without fail In access you can append records into a table and if a given record fails, the rest go in. I use that as a quick and dirty filter sometimes when (for example) appending records from one place to another. AFAICT SQL Server will not append any of the records if any single record fails to append, which has always seemed strange to me. It's almost like an unrequested rollback. Is there any way to make SQL Server accept the appends that will go in and only reject the ones that will not for some reason? -- John W. Colby www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Mon May 2 16:23:37 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Mon, 02 May 2011 17:23:37 -0400 Subject: [dba-SQLServer] SQL Server - Append records without fail In-Reply-To: <71345C412B464389BAD067771E90DB06@abpc> References: <4DBF13A9.9080503@colbyconsulting.com> <71345C412B464389BAD067771E90DB06@abpc> Message-ID: <4DBF20D9.1090805@colbyconsulting.com> OK, good to know! Thanks, John W. Colby www.ColbyConsulting.com On 5/2/2011 5:18 PM, Asger Blond wrote: > John, > If the unique index is created with the option IGNORE_DUP_KEY then the behaviour will be the same as in Access. > Asger > > -----Oprindelig meddelelse----- > Fra: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] P? vegne af jwcolby > Sendt: 2. maj 2011 22:27 > Til: Access Developers discussion and problem solving; Sqlserver-Dba > Emne: [dba-SQLServer] SQL Server - Append records without fail > > In access you can append records into a table and if a given record fails, the rest go in. I use > that as a quick and dirty filter sometimes when (for example) appending records from one place to > another. > > AFAICT SQL Server will not append any of the records if any single record fails to append, which has > always seemed strange to me. It's almost like an unrequested rollback. > > Is there any way to make SQL Server accept the appends that will go in and only reject the ones that > will not for some reason? > From ab-mi at post3.tele.dk Mon May 2 17:12:23 2011 From: ab-mi at post3.tele.dk (Asger Blond) Date: Tue, 3 May 2011 00:12:23 +0200 Subject: [dba-SQLServer] SQL Server - Append records without fail In-Reply-To: <4DBF20D9.1090805@colbyconsulting.com> References: <4DBF13A9.9080503@colbyconsulting.com><71345C412B464389BAD067771E90DB06@abpc> <4DBF20D9.1090805@colbyconsulting.com> Message-ID: And BTW this goes for both plain unique indexes and for primary keys as demonstrated below: -- Unique index: CREATE TABLE T1(C1 int) GO CREATE UNIQUE INDEX UI_C1 on T1(C1) GO INSERT INTO T1 VALUES(3) INSERT INTO T1 VALUES(4) INSERT INTO T1 VALUES(5) INSERT INTO T1 VALUES(6) GO CREATE TABLE T2(C1 int) GO INSERT INTO T2 VALUES(1) INSERT INTO T2 VALUES(2) INSERT INTO T2 VALUES(3) INSERT INTO T2 VALUES(4) INSERT INTO T2 VALUES(7) GO INSERT INTO T1 SELECT C1 FROM T2 -->Error SELECT * FROM T1-->All inserts cancelled GO ALTER INDEX UI_C1 ON T1 REBUILD WITH (IGNORE_DUP_KEY = ON) GO INSERT INTO T1 SELECT C1 FROM T2 -->Warning: Duplicate key was ignored SELECT * FROM T1-->All inserts succeeded except for those creating key-duplicates, behaviour as in Access -- Primary key: CREATE TABLE T3(C1 int CONSTRAINT PK_C1 PRIMARY KEY) GO INSERT INTO T3 VALUES(3) INSERT INTO T3 VALUES(4) INSERT INTO T3 VALUES(5) INSERT INTO T3 VALUES(6) GO INSERT INTO T3 SELECT C1 FROM T2 -->Error SELECT * FROM T3-->All inserts cancelled GO ALTER TABLE T3 DROP CONSTRAINT PK_C1 GO ALTER TABLE T3 ADD CONSTRAINT PK_C1 PRIMARY KEY (C1) WITH (IGNORE_DUP_KEY = ON) GO INSERT INTO T3 SELECT C1 FROM T2 -->Warning: Duplicate key was ignored SELECT * FROM T3-->All inserts succeeded except for those creating key-duplicates, behaviour as in Access Asger -----Oprindelig meddelelse----- Fra: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] P? vegne af jwcolby Sendt: 2. maj 2011 23:24 Til: Discussion concerning MS SQL Server Emne: Re: [dba-SQLServer] SQL Server - Append records without fail OK, good to know! Thanks, John W. Colby www.ColbyConsulting.com On 5/2/2011 5:18 PM, Asger Blond wrote: > John, > If the unique index is created with the option IGNORE_DUP_KEY then the behaviour will be the same as in Access. > Asger > > -----Oprindelig meddelelse----- > Fra: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] P? vegne af jwcolby > Sendt: 2. maj 2011 22:27 > Til: Access Developers discussion and problem solving; Sqlserver-Dba > Emne: [dba-SQLServer] SQL Server - Append records without fail > > In access you can append records into a table and if a given record fails, the rest go in. I use > that as a quick and dirty filter sometimes when (for example) appending records from one place to > another. > > AFAICT SQL Server will not append any of the records if any single record fails to append, which has > always seemed strange to me. It's almost like an unrequested rollback. > > Is there any way to make SQL Server accept the appends that will go in and only reject the ones that > will not for some reason? > _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Thu May 12 14:28:03 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Thu, 12 May 2011 15:28:03 -0400 Subject: [dba-SQLServer] =?windows-1252?q?LSI_MegaRAID_SAS/SATA_9265-8i_6G?= =?windows-1252?q?b/s_PCIe_RAID_Card_Review_=96_Performance_Unleashed!_=7C?= =?windows-1252?q?_The_SSD_Review?= Message-ID: <4DCC34C3.4080302@colbyconsulting.com> -- John W. Colby www.ColbyConsulting.com http://thessdreview.com/our-reviews/lsi-megaraid-sassata-9265-8i-6gbs-pcie-raid-controller-card-review/ From dbdoug at gmail.com Thu May 12 21:31:49 2011 From: dbdoug at gmail.com (Doug Steele) Date: Thu, 12 May 2011 19:31:49 -0700 Subject: [dba-SQLServer] =?windows-1252?q?LSI_MegaRAID_SAS/SATA_9265-8i_6G?= =?windows-1252?q?b/s_PCIe_RAID_Card_Review_=96_Performance_Unleash?= =?windows-1252?q?ed!_=7C_The_SSD_Review?= In-Reply-To: <4DCC34C3.4080302@colbyconsulting.com> References: <4DCC34C3.4080302@colbyconsulting.com> Message-ID: Impressive. But will it fit in my iPad? Doug On Thu, May 12, 2011 at 12:28 PM, jwcolby wrote: > > -- > John W. Colby > www.ColbyConsulting.com > http://thessdreview.com/our-reviews/lsi-megaraid-sassata-9265-8i-6gbs-pcie-raid-controller-card-review/ > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From fuller.artful at gmail.com Sun May 15 10:37:44 2011 From: fuller.artful at gmail.com (Arthur Fuller) Date: Sun, 15 May 2011 11:37:44 -0400 Subject: [dba-SQLServer] Problem Finding Database Engine Message-ID: Lately I've been rebuilding my main box. It's running Windows 7 Ultimate 64-bit, and SQL 2008 Enterprise 64-bit.The SQL installation seemed to go perfectly, but when I try to run Management Studio I am unable to connect. I get a message saying "a network or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remove connections. (provider:Named Pipes Provider, error: 40 - Could not open a connection to SQL Server, error: 2). This was from trying to connect to Database Engine. However I am able to connect to Analysis Services (which happens to contain no databases at the moment, but at least I can connect). Any idea what might be wrong and how I can fix it? TIA, Arthur From dbdoug at gmail.com Sun May 15 10:46:59 2011 From: dbdoug at gmail.com (Doug Steele) Date: Sun, 15 May 2011 08:46:59 -0700 Subject: [dba-SQLServer] Problem Finding Database Engine In-Reply-To: References: Message-ID: Is the SQL Server service actually running? I had a problem recently where the service, despite being set as 'automatic', failed to load properly when the computer started up. Doug On Sun, May 15, 2011 at 8:37 AM, Arthur Fuller wrote: > Lately I've been rebuilding my main box. It's running Windows 7 Ultimate > 64-bit, and SQL 2008 Enterprise 64-bit.The SQL installation seemed to go > perfectly, but when I try to run Management Studio I am unable to connect. I > get a message saying "a network or instance-specific error occurred while > establishing a connection to SQL Server. The server was not found or was not > accessible. Verify that the instance name is correct and that SQL Server is > configured to allow remove connections. (provider:Named Pipes Provider, > error: 40 - Could not open a connection to SQL Server, error: 2). > This was from trying to connect to Database Engine. However I am able to > connect to Analysis Services (which happens to contain no databases at the > moment, but at least I can connect). > > Any idea what might be wrong and how I can fix it? > > TIA, > Arthur > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From fuller.artful at gmail.com Sun May 15 12:32:03 2011 From: fuller.artful at gmail.com (Arthur Fuller) Date: Sun, 15 May 2011 13:32:03 -0400 Subject: [dba-SQLServer] Problem Finding Database Engine In-Reply-To: References: Message-ID: I don't see an item in the service tray indicating that. Also, I can't remember how to invoke the engine manager itself (been on other projects lately and haven't been using SQL lately). Or perhaps it's a KPI of Alzheimers... Arthur On Sun, May 15, 2011 at 11:46 AM, Doug Steele wrote: > Is the SQL Server service actually running? I had a problem recently > where the service, despite being set as 'automatic', failed to load > properly when the computer started up. > > Doug > > From accessd at shaw.ca Sun May 15 14:10:24 2011 From: accessd at shaw.ca (Jim Lawrence) Date: Sun, 15 May 2011 12:10:24 -0700 Subject: [dba-SQLServer] Problem Finding Database Engine In-Reply-To: References: Message-ID: Hi Arthur: Ran into a similar issue the other day after installing MS SQL 2008 64bit. Unlike other MS SQL versions all connect protocols are turned off by default; no TCP/IP, Named Pipes etc. I spent the better part of a couple of hours to find the spot to turn everything on. It may seem something stupid but it sure had me confused for a bit. I just kept testing with the ODBC manager until the server lit up. HTH Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller Sent: Sunday, May 15, 2011 8:38 AM To: Discussion concerning MS SQL Server Subject: [dba-SQLServer] Problem Finding Database Engine Lately I've been rebuilding my main box. It's running Windows 7 Ultimate 64-bit, and SQL 2008 Enterprise 64-bit.The SQL installation seemed to go perfectly, but when I try to run Management Studio I am unable to connect. I get a message saying "a network or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remove connections. (provider:Named Pipes Provider, error: 40 - Could not open a connection to SQL Server, error: 2). This was from trying to connect to Database Engine. However I am able to connect to Analysis Services (which happens to contain no databases at the moment, but at least I can connect). Any idea what might be wrong and how I can fix it? TIA, Arthur _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From mwp.reid at qub.ac.uk Sun May 15 14:13:44 2011 From: mwp.reid at qub.ac.uk (Martin Reid) Date: Sun, 15 May 2011 20:13:44 +0100 Subject: [dba-SQLServer] Problem Finding Database Engine In-Reply-To: References: , Message-ID: <631CF83223105545BF43EFB52CB082954924E6DA59@EX2K7-VIRT-2.ads.qub.ac.uk> Hi Arthur Have a look at surface area configuration/management and make sure enable remote connections is checked as well as all the required protocols. Martin Martin WP Reid Information Services The McClay Library Queen's University of Belfast 10 College Park Belfast BT7 1LP Tel : 02890976174 Email : mwp.reid at qub.ac.uk Sharepoint Training Portal ________________________________________ From: dba-sqlserver-bounces at databaseadvisors.com [dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence [accessd at shaw.ca] Sent: 15 May 2011 20:10 To: 'Discussion concerning MS SQL Server' Subject: Re: [dba-SQLServer] Problem Finding Database Engine Hi Arthur: Ran into a similar issue the other day after installing MS SQL 2008 64bit. Unlike other MS SQL versions all connect protocols are turned off by default; no TCP/IP, Named Pipes etc. I spent the better part of a couple of hours to find the spot to turn everything on. It may seem something stupid but it sure had me confused for a bit. I just kept testing with the ODBC manager until the server lit up. HTH Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller Sent: Sunday, May 15, 2011 8:38 AM To: Discussion concerning MS SQL Server Subject: [dba-SQLServer] Problem Finding Database Engine Lately I've been rebuilding my main box. It's running Windows 7 Ultimate 64-bit, and SQL 2008 Enterprise 64-bit.The SQL installation seemed to go perfectly, but when I try to run Management Studio I am unable to connect. I get a message saying "a network or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remove connections. (provider:Named Pipes Provider, error: 40 - Could not open a connection to SQL Server, error: 2). This was from trying to connect to Database Engine. However I am able to connect to Analysis Services (which happens to contain no databases at the moment, but at least I can connect). Any idea what might be wrong and how I can fix it? TIA, Arthur _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From dbdoug at gmail.com Sun May 15 14:15:07 2011 From: dbdoug at gmail.com (Doug Steele) Date: Sun, 15 May 2011 12:15:07 -0700 Subject: [dba-SQLServer] Problem Finding Database Engine In-Reply-To: References: Message-ID: Hi Arthur: You need to use the management console. In Windows 7, Control Panel then System and Security then Administrative Tools then Computer Management then Services and Applications then Services. In the list of services look for 'SQL Server'. The Status should be 'Started' and the Startup Type should be Automatic. If the Status isn't 'Started' then you can start it by right clicking on the name and selecting 'Start'. If the Startup Type is Automatic and it won't start when you boot the computer, you have to look at the system logs to find out why it's failing. I'll send more info if you need it. Doug On Sun, May 15, 2011 at 10:32 AM, Arthur Fuller wrote: > I don't see an item in the service tray indicating that. Also, I can't > remember how to invoke the engine manager itself (been on other projects > lately and haven't been using SQL lately). Or perhaps it's a KPI of > Alzheimers... > > Arthur > > On Sun, May 15, 2011 at 11:46 AM, Doug Steele wrote: > >> Is the SQL Server service actually running? ?I had a problem recently >> where the service, despite being set as 'automatic', failed to load >> properly when the computer started up. >> >> Doug >> >> > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From df.waters at comcast.net Sun May 15 14:25:44 2011 From: df.waters at comcast.net (Dan Waters) Date: Sun, 15 May 2011 14:25:44 -0500 Subject: [dba-SQLServer] Problem Finding Database Engine In-Reply-To: References: Message-ID: <002f01cc1335$e36fef60$aa4fce20$@comcast.net> Hi Arthur, I've always connected via TCP/IP. IIRC, Management Studio is a remote connection to SQL Server, even on the same PC. Because only TCP/IP handles remote requests, that's what must be used to be able to connect with Management Studio (and probably Visual Studio as well). Under administrative, go to the Computer Management control panel. At the bottom open up Services and Applications. Then you'll see SQL Server Configuration Manager. Now you'll see SQL Server Network Configuration - open that and then open Protocols for SQL Server. You'll see the list of protocols - enable TCP/IP and disable the others. You may also see SQL Native Client 10.0 Configuration. Open that and then open Client Protocols. Again you'll see the list of protocols - enable TCP/IP and disable the others. Hope that works! Dan -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller Sent: Sunday, May 15, 2011 10:38 AM To: Discussion concerning MS SQL Server Subject: [dba-SQLServer] Problem Finding Database Engine Lately I've been rebuilding my main box. It's running Windows 7 Ultimate 64-bit, and SQL 2008 Enterprise 64-bit.The SQL installation seemed to go perfectly, but when I try to run Management Studio I am unable to connect. I get a message saying "a network or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remove connections. (provider:Named Pipes Provider, error: 40 - Could not open a connection to SQL Server, error: 2). This was from trying to connect to Database Engine. However I am able to connect to Analysis Services (which happens to contain no databases at the moment, but at least I can connect). Any idea what might be wrong and how I can fix it? TIA, Arthur _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Sun May 15 20:34:50 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sun, 15 May 2011 21:34:50 -0400 Subject: [dba-SQLServer] Problem Finding Database Engine In-Reply-To: References: Message-ID: <4DD07F3A.8070202@colbyconsulting.com> You need to go into services and see if the service is running. You will not see it in the application tray. John W. Colby www.ColbyConsulting.com On 5/15/2011 1:32 PM, Arthur Fuller wrote: > I don't see an item in the service tray indicating that. Also, I can't > remember how to invoke the engine manager itself (been on other projects > lately and haven't been using SQL lately). Or perhaps it's a KPI of > Alzheimers... > > Arthur > > On Sun, May 15, 2011 at 11:46 AM, Doug Steele wrote: > >> Is the SQL Server service actually running? I had a problem recently >> where the service, despite being set as 'automatic', failed to load >> properly when the computer started up. >> >> Doug >> >> > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From jwcolby at colbyconsulting.com Sun May 15 20:36:53 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sun, 15 May 2011 21:36:53 -0400 Subject: [dba-SQLServer] Problem Finding Database Engine In-Reply-To: References: Message-ID: <4DD07FB5.6020204@colbyconsulting.com> > You need to use the management console. In Windows 7, Control Panel then System and Security then Administrative Tools then Computer Management then Services and Applications then Services. Is that buried deep enough for ya? ;) Drag it out into quick launch tool bar. John W. Colby www.ColbyConsulting.com On 5/15/2011 3:15 PM, Doug Steele wrote: > Hi Arthur: > > You need to use the management console. In Windows 7, Control Panel > then System and Security then Administrative Tools then Computer > Management then Services and Applications then Services. In the list > of services look for 'SQL Server'. The Status should be 'Started' and > the Startup Type should be Automatic. If the Status isn't 'Started' > then you can start it by right clicking on the name and selecting > 'Start'. > > If the Startup Type is Automatic and it won't start when you boot the > computer, you have to look at the system logs to find out why it's > failing. I'll send more info if you need it. > > Doug > > On Sun, May 15, 2011 at 10:32 AM, Arthur Fuller wrote: >> I don't see an item in the service tray indicating that. Also, I can't >> remember how to invoke the engine manager itself (been on other projects >> lately and haven't been using SQL lately). Or perhaps it's a KPI of >> Alzheimers... >> >> Arthur >> >> On Sun, May 15, 2011 at 11:46 AM, Doug Steele wrote: >> >>> Is the SQL Server service actually running? I had a problem recently >>> where the service, despite being set as 'automatic', failed to load >>> properly when the computer started up. >>> >>> Doug >>> >>> >> _______________________________________________ >> dba-SQLServer mailing list >> dba-SQLServer at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >> http://www.databaseadvisors.com >> >> > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From mwp.reid at qub.ac.uk Mon May 16 02:36:47 2011 From: mwp.reid at qub.ac.uk (Martin Reid) Date: Mon, 16 May 2011 08:36:47 +0100 Subject: [dba-SQLServer] Problem Finding Database Engine In-Reply-To: <4DD07FB5.6020204@colbyconsulting.com> References: <4DD07FB5.6020204@colbyconsulting.com> Message-ID: <631CF83223105545BF43EFB52CB082954924AB7D10@EX2K7-VIRT-2.ads.qub.ac.uk> Am I missing something here Start->All Programs->SQL Server 2008 R2->SQL Server Configuration Manager Martin From fuller.artful at gmail.com Mon May 16 06:13:42 2011 From: fuller.artful at gmail.com (Arthur Fuller) Date: Mon, 16 May 2011 07:13:42 -0400 Subject: [dba-SQLServer] Problem Finding Database Engine In-Reply-To: <002f01cc1335$e36fef60$aa4fce20$@comcast.net> References: <002f01cc1335$e36fef60$aa4fce20$@comcast.net> Message-ID: Thanks Doug and Dan. All seems to be working now. Arthur On Sun, May 15, 2011 at 3:25 PM, Dan Waters wrote: > Hi Arthur, > > I've always connected via TCP/IP. IIRC, Management Studio is a remote > connection to SQL Server, even on the same PC. Because only TCP/IP handles > remote requests, that's what must be used to be able to connect with > Management Studio (and probably Visual Studio as well). > > Under administrative, go to the Computer Management control panel. At the > bottom open up Services and Applications. Then you'll see SQL Server > Configuration Manager. > > Now you'll see SQL Server Network Configuration - open that and then open > Protocols for SQL Server. You'll see the list of protocols - enable TCP/IP > and disable the others. > > You may also see SQL Native Client 10.0 Configuration. Open that and then > open Client Protocols. Again you'll see the list of protocols - enable > TCP/IP and disable the others. > > > Hope that works! > Dan > > -----Original Message----- > From: dba-sqlserver-bounces at databaseadvisors.com > [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Arthur > Fuller > Sent: Sunday, May 15, 2011 10:38 AM > To: Discussion concerning MS SQL Server > Subject: [dba-SQLServer] Problem Finding Database Engine > > Lately I've been rebuilding my main box. It's running Windows 7 Ultimate > 64-bit, and SQL 2008 Enterprise 64-bit.The SQL installation seemed to go > perfectly, but when I try to run Management Studio I am unable to connect. > I > get a message saying "a network or instance-specific error occurred while > establishing a connection to SQL Server. The server was not found or was > not > accessible. Verify that the instance name is correct and that SQL Server is > configured to allow remove connections. (provider:Named Pipes Provider, > error: 40 - Could not open a connection to SQL Server, error: 2). > This was from trying to connect to Database Engine. However I am able to > connect to Analysis Services (which happens to contain no databases at the > moment, but at least I can connect). > > Any idea what might be wrong and how I can fix it? > > TIA, > Arthur > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From dbdoug at gmail.com Mon May 16 08:20:29 2011 From: dbdoug at gmail.com (Doug Steele) Date: Mon, 16 May 2011 06:20:29 -0700 Subject: [dba-SQLServer] Problem Finding Database Engine In-Reply-To: <631CF83223105545BF43EFB52CB082954924AB7D10@EX2K7-VIRT-2.ads.qub.ac.uk> References: <4DD07FB5.6020204@colbyconsulting.com> <631CF83223105545BF43EFB52CB082954924AB7D10@EX2K7-VIRT-2.ads.qub.ac.uk> Message-ID: Hi Martin: You're right - you can also get to the service through the SQL Configuration Manager. I happen to use the Windows Management Console from time to time, so that's the way I find it myself. Thanks, Doug On Mon, May 16, 2011 at 12:36 AM, Martin Reid wrote: > Am I missing something here > > Start->All Programs->SQL Server 2008 R2->SQL Server Configuration Manager > > Martin > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From jwcolby at colbyconsulting.com Fri May 20 12:02:12 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Fri, 20 May 2011 13:02:12 -0400 Subject: [dba-SQLServer] Views don't sort Message-ID: <4DD69E94.5000100@colbyconsulting.com> One of the things I am trying to do is use SQL Server to speed up my applications. The theory is that I can hand off the heavy lifting to SQL Server and just get back result sets. Of course this works in terms of joins and filters in a view, but even though I specify a sort in a view, when the result set hits the other end (Access in my case) it is unsorted. Views have the ability to do sorts, so why is the data returned by a view into a third party app, or even into another view in SQL Server unsorted? Is there a way to tell sql server to return sorted data? -- John W. Colby www.ColbyConsulting.com From fhtapia at gmail.com Fri May 20 12:07:03 2011 From: fhtapia at gmail.com (Francisco Tapia) Date: Fri, 20 May 2011 10:07:03 -0700 Subject: [dba-SQLServer] Views don't sort In-Reply-To: <4DD69E94.5000100@colbyconsulting.com> References: <4DD69E94.5000100@colbyconsulting.com> Message-ID: So something like: Create View vwSomeView AS Select TOP 99.9999 percent Field1, Field2, Field3 >From tblSomeTable Order by Field3 does not sort field3? what are your results when you just select * from vwSomeView ? are the results sorted in your results display in management studio? -Francisco On Fri, May 20, 2011 at 10:02 AM, jwcolby wrote: > One of the things I am trying to do is use SQL Server to speed up my > applications. The theory is that I can hand off the heavy lifting to SQL > Server and just get back result sets. Of course this works in terms of > joins and filters in a view, but even though I specify a sort in a view, > when the result set hits the other end (Access in my case) it is unsorted. > > Views have the ability to do sorts, so why is the data returned by a view > into a third party app, or even into another view in SQL Server unsorted? > Is there a way to tell sql server to return sorted data? > > > From jwcolby at colbyconsulting.com Fri May 20 12:26:15 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Fri, 20 May 2011 13:26:15 -0400 Subject: [dba-SQLServer] Views don't sort In-Reply-To: References: <4DD69E94.5000100@colbyconsulting.com> Message-ID: <4DD6A437.6000904@colbyconsulting.com> Francisco, The sql from the view. SELECT TOP (100) PERCENT INM_ID, INM_LName + ', ' + INM_FName AS Name FROM dbo.tblInmate WHERE (INM_Active <> 0) ORDER BY Name This specific view is sorting ascending on the name field (calculated obviously). It does return sorted if I open it in design view and then bang the query. 32 BROWN, ANTHONY 35 CHISGAR, DENNIS 29 COCHRAN, ROBERT 33 COLLINS, WILLIE 36 EDMISTEN, FRED 37 EDWARDS, CASEY 6 ERVIN, DAVID but if I open a query and do select * from QryXYZ INM_ID Name 4 HUSH, KEITH 5 HODSDEN, MARK 6 ERVIN, DAVID 10 PRATT, BAXTER 11 POWELL, BOBBY 15 TURNER, CHARLES 17 HARDISON, DAVID 19 JONES, JEFFREY It appears that the query is getting the data sorted by the PKID (which has a clustered index on it). Back in access I get the same "ordered by PKID" order. John W. Colby www.ColbyConsulting.com On 5/20/2011 1:07 PM, Francisco Tapia wrote: > So something like: > > Create View vwSomeView AS > Select TOP 99.9999 percent Field1, Field2, Field3 >> From tblSomeTable > Order by Field3 > > does not sort field3? what are your results when you just select * from > vwSomeView ? are the results sorted in your results display in management > studio? > > > -Francisco > > > > > On Fri, May 20, 2011 at 10:02 AM, jwcolbywrote: > >> One of the things I am trying to do is use SQL Server to speed up my >> applications. The theory is that I can hand off the heavy lifting to SQL >> Server and just get back result sets. Of course this works in terms of >> joins and filters in a view, but even though I specify a sort in a view, >> when the result set hits the other end (Access in my case) it is unsorted. >> >> Views have the ability to do sorts, so why is the data returned by a view >> into a third party app, or even into another view in SQL Server unsorted? >> Is there a way to tell sql server to return sorted data? >> >> >> > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From jwcolby at colbyconsulting.com Fri May 20 12:31:42 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Fri, 20 May 2011 13:31:42 -0400 Subject: [dba-SQLServer] Views don't sort In-Reply-To: References: <4DD69E94.5000100@colbyconsulting.com> Message-ID: <4DD6A57E.7070309@colbyconsulting.com> Francisco, I apparently ignored your top 99.999% part. When I went back in to my view and selected top 1 million (very big) it did in fact return a sorted data set. Thanks! John W. Colby www.ColbyConsulting.com On 5/20/2011 1:07 PM, Francisco Tapia wrote: > So something like: > > Create View vwSomeView AS > Select TOP 99.9999 percent Field1, Field2, Field3 >> From tblSomeTable > Order by Field3 > > does not sort field3? what are your results when you just select * from > vwSomeView ? are the results sorted in your results display in management > studio? > > > -Francisco > > > > > On Fri, May 20, 2011 at 10:02 AM, jwcolbywrote: > >> One of the things I am trying to do is use SQL Server to speed up my >> applications. The theory is that I can hand off the heavy lifting to SQL >> Server and just get back result sets. Of course this works in terms of >> joins and filters in a view, but even though I specify a sort in a view, >> when the result set hits the other end (Access in my case) it is unsorted. >> >> Views have the ability to do sorts, so why is the data returned by a view >> into a third party app, or even into another view in SQL Server unsorted? >> Is there a way to tell sql server to return sorted data? >> >> >> > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From stuart at lexacorp.com.pg Fri May 20 15:47:35 2011 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Sat, 21 May 2011 06:47:35 +1000 Subject: [dba-SQLServer] Views don't sort In-Reply-To: <4DD6A57E.7070309@colbyconsulting.com> References: <4DD69E94.5000100@colbyconsulting.com>, , <4DD6A57E.7070309@colbyconsulting.com> Message-ID: <4DD6D367.19607.1B6A2E6F@stuart.lexacorp.com.pg> Be careful with that. It is not guaranteed to work! See http://msdn.microsoft.com/en-us/library/ms188385.aspx The ORDER BY clause is not valid in views, inline functions, derived tables, and subqueries, unless TOP is also specified. ... When ORDER BY is used in the definition of a view, inline function, derived table, or subquery, the clause is used only to determine the rows returned by the TOP clause. The ORDER BY clause does not guarantee ordered results when these constructs are queried, unless ORDER BY is also specified in the query itself The only way to be sure is to use "Select * from vwMyView Order by colMyCol" -- Stuart On 20 May 2011 at 13:31, jwcolby wrote: > Francisco, > > I apparently ignored your top 99.999% part. > > When I went back in to my view and selected top 1 million (very big) > it did in fact return a sorted data set. > > Thanks! > > John W. Colby > www.ColbyConsulting.com > > On 5/20/2011 1:07 PM, Francisco Tapia wrote: > > So something like: > > > > Create View vwSomeView AS > > Select TOP 99.9999 percent Field1, Field2, Field3 > >> From tblSomeTable > > Order by Field3 > > > > does not sort field3? what are your results when you just select * > > from vwSomeView ? are the results sorted in your results display in > > management studio? > > > > > > -Francisco > > > > > > > > > > On Fri, May 20, 2011 at 10:02 AM, > > jwcolbywrote: > > > >> One of the things I am trying to do is use SQL Server to speed up > >> my applications. The theory is that I can hand off the heavy > >> lifting to SQL Server and just get back result sets. Of course > >> this works in terms of joins and filters in a view, but even though > >> I specify a sort in a view, when the result set hits the other end > >> (Access in my case) it is unsorted. > >> > >> Views have the ability to do sorts, so why is the data returned by > >> a view into a third party app, or even into another view in SQL > >> Server unsorted? > >> Is there a way to tell sql server to return sorted data? > >> > >> > >> > > _______________________________________________ > > dba-SQLServer mailing list > > dba-SQLServer at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > http://www.databaseadvisors.com > > > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From fhtapia at gmail.com Fri May 20 16:43:25 2011 From: fhtapia at gmail.com (Francisco Tapia) Date: Fri, 20 May 2011 14:43:25 -0700 Subject: [dba-SQLServer] Views don't sort In-Reply-To: <4DD6A437.6000904@colbyconsulting.com> References: <4DD69E94.5000100@colbyconsulting.com> <4DD6A437.6000904@colbyconsulting.com> Message-ID: John, Please review my notation, of TOP 99.99999 percent (I think you can go out 9 digits after the decimal, there is a bug that for some reason did not get addressed until after sql server 2008 came out, and now you need to apply hotfixes to get it to work right (or just switch from top 100 percent to top 99.99999 percent http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b926292&sd=rss&spid=2855 add that to your view and you should see the results get re-organize appropriately w/o having to apply the hotfix. i know that for a while ms was taking the position that the order by clause in a view was non-ansi92 standards compliant, but then... how much of their tsql is? :) all vendors make concessions, but I think they had some bug within the engine during the optimization process. in Access if you create the link to your view as a LINKED query you can optionally also choose the query to be as Select * from viewMyView Order by MyCriteria = criteria and that will also provide all the heavy lifting on the sql engine side. hth... -Francisco http://bit.ly/sqlthis | Tsql and More... http://db.tt/JeXURAx | Drop Box, Storage in the Cloud (free) On Fri, May 20, 2011 at 10:26 AM, jwcolby wrote: > Francisco, > > The sql from the view. > > SELECT TOP (100) PERCENT INM_ID, INM_LName + ', ' + INM_FName AS Name > FROM dbo.tblInmate > WHERE (INM_Active <> 0) > ORDER BY Name > > This specific view is sorting ascending on the name field (calculated > obviously). > > It does return sorted if I open it in design view and then bang the query. > > 32 BROWN, ANTHONY > 35 CHISGAR, DENNIS > 29 COCHRAN, ROBERT > 33 COLLINS, WILLIE > 36 EDMISTEN, FRED > 37 EDWARDS, CASEY > 6 ERVIN, DAVID > > but if I open a query and do select * from QryXYZ > > INM_ID Name > 4 HUSH, KEITH > 5 HODSDEN, MARK > 6 ERVIN, DAVID > 10 PRATT, BAXTER > 11 POWELL, BOBBY > 15 TURNER, CHARLES > 17 HARDISON, DAVID > 19 JONES, JEFFREY > > It appears that the query is getting the data sorted by the PKID (which has > a clustered index on it). Back in access I get the same "ordered by PKID" > order. > > > John W. Colby > www.ColbyConsulting.com > > On 5/20/2011 1:07 PM, Francisco Tapia wrote: > >> So something like: >> >> Create View vwSomeView AS >> Select TOP 99.9999 percent Field1, Field2, Field3 >> >>> From tblSomeTable >>> >> Order by Field3 >> >> does not sort field3? what are your results when you just select * from >> vwSomeView ? are the results sorted in your results display in management >> studio? >> >> >> -Francisco >> >> >> >> >> >> On Fri, May 20, 2011 at 10:02 AM, jwcolby> >wrote: >> >> One of the things I am trying to do is use SQL Server to speed up my >>> applications. The theory is that I can hand off the heavy lifting to SQL >>> Server and just get back result sets. Of course this works in terms of >>> joins and filters in a view, but even though I specify a sort in a view, >>> when the result set hits the other end (Access in my case) it is >>> unsorted. >>> >>> Views have the ability to do sorts, so why is the data returned by a view >>> into a third party app, or even into another view in SQL Server unsorted? >>> Is there a way to tell sql server to return sorted data? >>> >>> >>> >>> _______________________________________________ >> dba-SQLServer mailing list >> dba-SQLServer at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >> http://www.databaseadvisors.com >> >> >> _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From ab-mi at post3.tele.dk Fri May 20 17:09:01 2011 From: ab-mi at post3.tele.dk (Asger Blond) Date: Sat, 21 May 2011 00:09:01 +0200 Subject: [dba-SQLServer] Views don't sort In-Reply-To: <4DD6D367.19607.1B6A2E6F@stuart.lexacorp.com.pg> References: <4DD69E94.5000100@colbyconsulting.com>, , <4DD6A57E.7070309@colbyconsulting.com> <4DD6D367.19607.1B6A2E6F@stuart.lexacorp.com.pg> Message-ID: Well, and this quote from BOL just doesn't make any sense to me. The TOP and ORDER BY clause is used to "determine the rows returned", but it "does not guarantee ordered results" - WTF does this mean? I use the construct specified by Francisco, and have never seen problems. Asger -----Oprindelig meddelelse----- Fra: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] P? vegne af Stuart McLachlan Sendt: 20. maj 2011 22:48 Til: Discussion concerning MS SQL Server Emne: Re: [dba-SQLServer] Views don't sort Be careful with that. It is not guaranteed to work! See http://msdn.microsoft.com/en-us/library/ms188385.aspx The ORDER BY clause is not valid in views, inline functions, derived tables, and subqueries, unless TOP is also specified. ... When ORDER BY is used in the definition of a view, inline function, derived table, or subquery, the clause is used only to determine the rows returned by the TOP clause. The ORDER BY clause does not guarantee ordered results when these constructs are queried, unless ORDER BY is also specified in the query itself The only way to be sure is to use "Select * from vwMyView Order by colMyCol" -- Stuart On 20 May 2011 at 13:31, jwcolby wrote: > Francisco, > > I apparently ignored your top 99.999% part. > > When I went back in to my view and selected top 1 million (very big) > it did in fact return a sorted data set. > > Thanks! > > John W. Colby > www.ColbyConsulting.com > > On 5/20/2011 1:07 PM, Francisco Tapia wrote: > > So something like: > > > > Create View vwSomeView AS > > Select TOP 99.9999 percent Field1, Field2, Field3 > >> From tblSomeTable > > Order by Field3 > > > > does not sort field3? what are your results when you just select * > > from vwSomeView ? are the results sorted in your results display in > > management studio? > > > > > > -Francisco > > > > > > > > > > On Fri, May 20, 2011 at 10:02 AM, > > jwcolbywrote: > > > >> One of the things I am trying to do is use SQL Server to speed up > >> my applications. The theory is that I can hand off the heavy > >> lifting to SQL Server and just get back result sets. Of course > >> this works in terms of joins and filters in a view, but even though > >> I specify a sort in a view, when the result set hits the other end > >> (Access in my case) it is unsorted. > >> > >> Views have the ability to do sorts, so why is the data returned by > >> a view into a third party app, or even into another view in SQL > >> Server unsorted? > >> Is there a way to tell sql server to return sorted data? > >> > >> > >> > > _______________________________________________ > > dba-SQLServer mailing list > > dba-SQLServer at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > http://www.databaseadvisors.com > > > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri May 20 18:00:39 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Fri, 20 May 2011 19:00:39 -0400 Subject: [dba-SQLServer] Views don't sort In-Reply-To: <4DD6D367.19607.1B6A2E6F@stuart.lexacorp.com.pg> References: <4DD69E94.5000100@colbyconsulting.com>, , <4DD6A57E.7070309@colbyconsulting.com> <4DD6D367.19607.1B6A2E6F@stuart.lexacorp.com.pg> Message-ID: <4DD6F297.3030603@colbyconsulting.com> I understand that. Unfortunately to do it "the safe way" means that it has to be done by the Jet engine on the workstation. That means back to all of the index pulls etc. John W. Colby www.ColbyConsulting.com On 5/20/2011 4:47 PM, Stuart McLachlan wrote: > Be careful with that. It is not guaranteed to work! > > See http://msdn.microsoft.com/en-us/library/ms188385.aspx > > The ORDER BY clause is not valid in views, inline functions, derived tables, and subqueries, > unless TOP is also specified. > ... > When ORDER BY is used in the definition of a view, inline function, derived table, or > subquery, the clause is used only to determine the rows returned by the TOP clause. The > ORDER BY clause does not guarantee ordered results when these constructs are queried, > unless ORDER BY is also specified in the query itself > > > The only way to be sure is to use "Select * from vwMyView Order by colMyCol" > From davidmcafee at gmail.com Fri May 20 18:10:37 2011 From: davidmcafee at gmail.com (David McAfee) Date: Fri, 20 May 2011 16:10:37 -0700 Subject: [dba-SQLServer] Views don't sort In-Reply-To: <4DD6F297.3030603@colbyconsulting.com> References: <4DD69E94.5000100@colbyconsulting.com> <4DD6A57E.7070309@colbyconsulting.com> <4DD6D367.19607.1B6A2E6F@stuart.lexacorp.com.pg> <4DD6F297.3030603@colbyconsulting.com> Message-ID: Can't you just call it from a SPROC and use a pass through query to call that? CREATE PROCEDURE stpSomeSproc AS SELECT * FROM vwMyView ORDER BY colMyCol On Fri, May 20, 2011 at 4:00 PM, jwcolby wrote: > I understand that. Unfortunately to do it "the safe way" means that it has > to be done by the Jet engine on the workstation. That means back to all of > the index pulls etc. > > > John W. Colby > www.ColbyConsulting.com > > On 5/20/2011 4:47 PM, Stuart McLachlan wrote: > >> Be careful with that. It is not guaranteed to work! >> >> See http://msdn.microsoft.com/en-us/library/ms188385.aspx >> >> The ORDER BY clause is not valid in views, inline functions, derived >> tables, and subqueries, >> unless TOP is also specified. >> ... >> When ORDER BY is used in the definition of a view, inline function, >> derived table, or >> subquery, the clause is used only to determine the rows returned by the >> TOP clause. The >> ORDER BY clause does not guarantee ordered results when these constructs >> are queried, >> unless ORDER BY is also specified in the query itself >> >> >> The only way to be sure is to use "Select * from vwMyView Order by >> colMyCol" >> >> _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From fhtapia at gmail.com Fri May 20 19:26:48 2011 From: fhtapia at gmail.com (Francisco Tapia) Date: Fri, 20 May 2011 17:26:48 -0700 Subject: [dba-SQLServer] Views don't sort In-Reply-To: <4DD6F297.3030603@colbyconsulting.com> References: <4DD69E94.5000100@colbyconsulting.com> <4DD6A57E.7070309@colbyconsulting.com> <4DD6D367.19607.1B6A2E6F@stuart.lexacorp.com.pg> <4DD6F297.3030603@colbyconsulting.com> Message-ID: <5594821079385653491@unknownmsgid> John, We've been using the top 99.99999 method in house and while we do test our sp patches, we have not had any issues with that, but to try to avoid an unholy war, it would be good for you to figure out how to implement passthrough queries from access, it's generally the better way to link to views and sprocs on a server. Calling a view/Sproc in a passthrough query is just like banging out the request in a SQL query window Ie, select * from viewMyView Or exec stp_myFavoriteSproc param1, param2 Sent from my mobile On May 20, 2011, at 4:01 PM, jwcolby wrote: > I understand that. Unfortunately to do it "the safe way" means that it has to be done by the Jet engine on the workstation. That means back to all of the index pulls etc. > > John W. Colby > www.ColbyConsulting.com > > On 5/20/2011 4:47 PM, Stuart McLachlan wrote: >> Be careful with that. It is not guaranteed to work! >> >> See http://msdn.microsoft.com/en-us/library/ms188385.aspx >> >> The ORDER BY clause is not valid in views, inline functions, derived tables, and subqueries, >> unless TOP is also specified. >> ... >> When ORDER BY is used in the definition of a view, inline function, derived table, or >> subquery, the clause is used only to determine the rows returned by the TOP clause. The >> ORDER BY clause does not guarantee ordered results when these constructs are queried, >> unless ORDER BY is also specified in the query itself >> >> >> The only way to be sure is to use "Select * from vwMyView Order by colMyCol" >> > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > From stuart at lexacorp.com.pg Fri May 20 23:28:38 2011 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Sat, 21 May 2011 14:28:38 +1000 Subject: [dba-SQLServer] Views don't sort In-Reply-To: References: <4DD69E94.5000100@colbyconsulting.com>, <4DD6D367.19607.1B6A2E6F@stuart.lexacorp.com.pg>, Message-ID: <4DD73F76.29589.1D104F40@stuart.lexacorp.com.pg> It means that if you specify "SELECT TOP 5 FROM ALPHABET ORDER BY LETTER", you will always get A,B,C,D and E, but they may not necessarily be in that order. They may be returned as "E,D,C,B,A", "D,B,A,E,C" etc. Although it has worked up til now, it is just like any other hack that uses "undocumented features". - after the next patch, hotfix or service pack, you may find that it no longer works that way - the same records could be returned in a completely different sort order, possibly by PK or by the order in which they are physically stored on disk. -- Stuart On 21 May 2011 at 0:09, Asger Blond wrote: > Well, and this quote from BOL just doesn't make any sense to me. The > TOP and ORDER BY clause is used to "determine the rows returned", but > it "does not guarantee ordered results" - WTF does this mean? I use > the construct specified by Francisco, and have never seen problems. > Asger > > -----Oprindelig meddelelse----- > Fra: dba-sqlserver-bounces at databaseadvisors.com > [mailto:dba-sqlserver-bounces at databaseadvisors.com] P? vegne af > Stuart McLachlan Sendt: 20. maj 2011 22:48 Til: Discussion concerning > MS SQL Server Emne: Re: [dba-SQLServer] Views don't sort > > Be careful with that. It is not guaranteed to work! > > See http://msdn.microsoft.com/en-us/library/ms188385.aspx > > The ORDER BY clause is not valid in views, inline functions, derived > tables, and subqueries, unless TOP is also specified. ... When ORDER > BY is used in the definition of a view, inline function, derived > table, or subquery, the clause is used only to determine the rows > returned by the TOP clause. The ORDER BY clause does not guarantee > ordered results when these constructs are queried, unless ORDER BY is > also specified in the query itself > > The only way to be sure is to use "Select * from vwMyView Order by > colMyCol" > > -- > Stuart > > On 20 May 2011 at 13:31, jwcolby wrote: > > > Francisco, > > > > I apparently ignored your top 99.999% part. > > > > When I went back in to my view and selected top 1 million (very big) > > it did in fact return a sorted data set. > > > > Thanks! > > > > John W. Colby > > www.ColbyConsulting.com > > > > On 5/20/2011 1:07 PM, Francisco Tapia wrote: > > > So something like: > > > > > > Create View vwSomeView AS > > > Select TOP 99.9999 percent Field1, Field2, Field3 > > >> From tblSomeTable > > > Order by Field3 > > > > > > does not sort field3? what are your results when you just select > > > * from vwSomeView ? are the results sorted in your results > > > display in management studio? > > > > > > > > > -Francisco > > > > > > > > > > > > > > > On Fri, May 20, 2011 at 10:02 AM, > > > jwcolbywrote: > > > > > >> One of the things I am trying to do is use SQL Server to speed up > > >> my applications. The theory is that I can hand off the heavy > > >> lifting to SQL Server and just get back result sets. Of course > > >> this works in terms of joins and filters in a view, but even > > >> though I specify a sort in a view, when the result set hits the > > >> other end (Access in my case) it is unsorted. > > >> > > >> Views have the ability to do sorts, so why is the data returned > > >> by a view into a third party app, or even into another view in > > >> SQL Server unsorted? > > >> Is there a way to tell sql server to return sorted data? > > >> > > >> > > >> > > > _______________________________________________ > > > dba-SQLServer mailing list > > > dba-SQLServer at databaseadvisors.com > > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > > http://www.databaseadvisors.com > > > > > > > > _______________________________________________ > > dba-SQLServer mailing list > > dba-SQLServer at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > http://www.databaseadvisors.com > > > > > > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > From ab-mi at post3.tele.dk Sat May 21 04:33:34 2011 From: ab-mi at post3.tele.dk (Asger Blond) Date: Sat, 21 May 2011 11:33:34 +0200 Subject: [dba-SQLServer] Views don't sort In-Reply-To: <4DD73F76.29589.1D104F40@stuart.lexacorp.com.pg> References: <4DD69E94.5000100@colbyconsulting.com>, <4DD6D367.19607.1B6A2E6F@stuart.lexacorp.com.pg>, <4DD73F76.29589.1D104F40@stuart.lexacorp.com.pg> Message-ID: Thanks for the explanation, Stuart. Still I've never seen the result you indicate. The TOP 100 PERCENT is a special case where the query engine will ignore the ordering specified since you are actually requesting all rows. But if you force the engine to make a selection using TOP 99.999999999 PERCENT then it makes no sense to me why the engine should not return the rows in the order it's being forced to use for the selection. And certainly if you use TOP 5 it would be quite inefficient for the engine not to return the ordered rows. So: when the engine is forced to use a condition (TOP 5 or TOP 99.999999999) I've never seen a situation where the rows are not returned in the order specified by the query - whether this is embedded in a view or just run as a plain query. Asger -----Oprindelig meddelelse----- Fra: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] P? vegne af Stuart McLachlan Sendt: 21. maj 2011 06:29 Til: Discussion concerning MS SQL Server Emne: Re: [dba-SQLServer] Views don't sort It means that if you specify "SELECT TOP 5 FROM ALPHABET ORDER BY LETTER", you will always get A,B,C,D and E, but they may not necessarily be in that order. They may be returned as "E,D,C,B,A", "D,B,A,E,C" etc. Although it has worked up til now, it is just like any other hack that uses "undocumented features". - after the next patch, hotfix or service pack, you may find that it no longer works that way - the same records could be returned in a completely different sort order, possibly by PK or by the order in which they are physically stored on disk. -- Stuart On 21 May 2011 at 0:09, Asger Blond wrote: > Well, and this quote from BOL just doesn't make any sense to me. The > TOP and ORDER BY clause is used to "determine the rows returned", but > it "does not guarantee ordered results" - WTF does this mean? I use > the construct specified by Francisco, and have never seen problems. > Asger > > -----Oprindelig meddelelse----- > Fra: dba-sqlserver-bounces at databaseadvisors.com > [mailto:dba-sqlserver-bounces at databaseadvisors.com] P? vegne af > Stuart McLachlan Sendt: 20. maj 2011 22:48 Til: Discussion concerning > MS SQL Server Emne: Re: [dba-SQLServer] Views don't sort > > Be careful with that. It is not guaranteed to work! > > See http://msdn.microsoft.com/en-us/library/ms188385.aspx > > The ORDER BY clause is not valid in views, inline functions, derived > tables, and subqueries, unless TOP is also specified. ... When ORDER > BY is used in the definition of a view, inline function, derived > table, or subquery, the clause is used only to determine the rows > returned by the TOP clause. The ORDER BY clause does not guarantee > ordered results when these constructs are queried, unless ORDER BY is > also specified in the query itself > > The only way to be sure is to use "Select * from vwMyView Order by > colMyCol" > > -- > Stuart > > On 20 May 2011 at 13:31, jwcolby wrote: > > > Francisco, > > > > I apparently ignored your top 99.999% part. > > > > When I went back in to my view and selected top 1 million (very big) > > it did in fact return a sorted data set. > > > > Thanks! > > > > John W. Colby > > www.ColbyConsulting.com > > > > On 5/20/2011 1:07 PM, Francisco Tapia wrote: > > > So something like: > > > > > > Create View vwSomeView AS > > > Select TOP 99.9999 percent Field1, Field2, Field3 > > >> From tblSomeTable > > > Order by Field3 > > > > > > does not sort field3? what are your results when you just select > > > * from vwSomeView ? are the results sorted in your results > > > display in management studio? > > > > > > > > > -Francisco > > > > > > > > > > > > > > > On Fri, May 20, 2011 at 10:02 AM, > > > jwcolbywrote: > > > > > >> One of the things I am trying to do is use SQL Server to speed up > > >> my applications. The theory is that I can hand off the heavy > > >> lifting to SQL Server and just get back result sets. Of course > > >> this works in terms of joins and filters in a view, but even > > >> though I specify a sort in a view, when the result set hits the > > >> other end (Access in my case) it is unsorted. > > >> > > >> Views have the ability to do sorts, so why is the data returned > > >> by a view into a third party app, or even into another view in > > >> SQL Server unsorted? > > >> Is there a way to tell sql server to return sorted data? > > >> > > >> > > >> > > > _______________________________________________ > > > dba-SQLServer mailing list > > > dba-SQLServer at databaseadvisors.com > > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > > http://www.databaseadvisors.com > > > > > > > > _______________________________________________ > > dba-SQLServer mailing list > > dba-SQLServer at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > http://www.databaseadvisors.com > > > > > > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From marklbreen at gmail.com Mon May 23 03:21:32 2011 From: marklbreen at gmail.com (Mark Breen) Date: Mon, 23 May 2011 09:21:32 +0100 Subject: [dba-SQLServer] Views don't sort In-Reply-To: References: <4DD69E94.5000100@colbyconsulting.com> <4DD6D367.19607.1B6A2E6F@stuart.lexacorp.com.pg> <4DD73F76.29589.1D104F40@stuart.lexacorp.com.pg> Message-ID: Hello All, I too have seen SQL Server / Access not return the sorted records. I am intrigued by Francisco's suggestion to try the 99.99...... options, but I am in the habit now of never ordering within a view and always ordering when i select data from a view. In the cases where I can use an sproc, then I do not use a view at all, just include the select that would go in the view in the sproc instead. Then I can safely sort in the sproc and no worries about the client end. John, may I tell you about a trick that I sometimes do, and please exclude me if you are already doing this. I create a Past Through query in Access, which as you know, ignores jet and sends the query straight to the source db (SQL Server in this case). I then programatically change the 'SQL' of the qdef based on what I want to do. Sometimes, I just call the pass-through query qpstTemplate. The template bit being the connection string. Sometimes I have two, qpstTemplate_ReturnsRecords and qpstTemplate_NoRecords. The 'returns no records' flag is set in the second one and I can use that for action sprocs. I then set the sql to be *usp_GetCustomers*, then later set it again to * usp_GetOrdersByOrderDate* As a result, I often do not need to sort within Access. As you instinctively know, asking Jet to do this work is not the right course. Do you want to let SQL server do the heavy lifting for you. Any help? thanks Mark On 21 May 2011 10:33, Asger Blond wrote: > Thanks for the explanation, Stuart. Still I've never seen the result you > indicate. The TOP 100 PERCENT is a special case where the query engine will > ignore the ordering specified since you are actually requesting all rows. > But if you force the engine to make a selection using TOP 99.999999999 > PERCENT then it makes no sense to me why the engine should not return the > rows in the order it's being forced to use for the selection. And certainly > if you use TOP 5 it would be quite inefficient for the engine not to return > the ordered rows. So: when the engine is forced to use a condition (TOP 5 or > TOP 99.999999999) I've never seen a situation where the rows are not > returned in the order specified by the query - whether this is embedded in a > view or just run as a plain query. > Asger > > -----Oprindelig meddelelse----- > Fra: dba-sqlserver-bounces at databaseadvisors.com [mailto: > dba-sqlserver-bounces at databaseadvisors.com] P? vegne af Stuart McLachlan > Sendt: 21. maj 2011 06:29 > Til: Discussion concerning MS SQL Server > Emne: Re: [dba-SQLServer] Views don't sort > > It means that if you specify "SELECT TOP 5 FROM ALPHABET ORDER BY LETTER", > you > will always get A,B,C,D and E, but they may not necessarily be in that > order. They may be > returned as "E,D,C,B,A", "D,B,A,E,C" etc. > > Although it has worked up til now, it is just like any other hack that uses > "undocumented > features". - after the next patch, hotfix or service pack, you may find > that it no longer works > that way - the same records could be returned in a completely different > sort order, possibly by > PK or by the order in which they are physically stored on disk. > > -- > Stuart > > On 21 May 2011 at 0:09, Asger Blond wrote: > > > Well, and this quote from BOL just doesn't make any sense to me. The > > TOP and ORDER BY clause is used to "determine the rows returned", but > > it "does not guarantee ordered results" - WTF does this mean? I use > > the construct specified by Francisco, and have never seen problems. > > Asger > > > > -----Oprindelig meddelelse----- > > Fra: dba-sqlserver-bounces at databaseadvisors.com > > [mailto:dba-sqlserver-bounces at databaseadvisors.com] P? vegne af > > Stuart McLachlan Sendt: 20. maj 2011 22:48 Til: Discussion concerning > > MS SQL Server Emne: Re: [dba-SQLServer] Views don't sort > > > > Be careful with that. It is not guaranteed to work! > > > > See http://msdn.microsoft.com/en-us/library/ms188385.aspx > > > > The ORDER BY clause is not valid in views, inline functions, derived > > tables, and subqueries, unless TOP is also specified. ... When ORDER > > BY is used in the definition of a view, inline function, derived > > table, or subquery, the clause is used only to determine the rows > > returned by the TOP clause. The ORDER BY clause does not guarantee > > ordered results when these constructs are queried, unless ORDER BY is > > also specified in the query itself > > > > The only way to be sure is to use "Select * from vwMyView Order by > > colMyCol" > > > > -- > > Stuart > > > > On 20 May 2011 at 13:31, jwcolby wrote: > > > > > Francisco, > > > > > > I apparently ignored your top 99.999% part. > > > > > > When I went back in to my view and selected top 1 million (very big) > > > it did in fact return a sorted data set. > > > > > > Thanks! > > > > > > John W. Colby > > > www.ColbyConsulting.com > > > > > > On 5/20/2011 1:07 PM, Francisco Tapia wrote: > > > > So something like: > > > > > > > > Create View vwSomeView AS > > > > Select TOP 99.9999 percent Field1, Field2, Field3 > > > >> From tblSomeTable > > > > Order by Field3 > > > > > > > > does not sort field3? what are your results when you just select > > > > * from vwSomeView ? are the results sorted in your results > > > > display in management studio? > > > > > > > > > > > > -Francisco > > > > > > > > > > > > > > > > > > > > On Fri, May 20, 2011 at 10:02 AM, > > > > jwcolbywrote: > > > > > > > >> One of the things I am trying to do is use SQL Server to speed up > > > >> my applications. The theory is that I can hand off the heavy > > > >> lifting to SQL Server and just get back result sets. Of course > > > >> this works in terms of joins and filters in a view, but even > > > >> though I specify a sort in a view, when the result set hits the > > > >> other end (Access in my case) it is unsorted. > > > >> > > > >> Views have the ability to do sorts, so why is the data returned > > > >> by a view into a third party app, or even into another view in > > > >> SQL Server unsorted? > > > >> Is there a way to tell sql server to return sorted data? > > > >> > > > >> > > > >> > > > > _______________________________________________ > > > > dba-SQLServer mailing list > > > > dba-SQLServer at databaseadvisors.com > > > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > > > http://www.databaseadvisors.com > > > > > > > > > > > _______________________________________________ > > > dba-SQLServer mailing list > > > dba-SQLServer at databaseadvisors.com > > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > > http://www.databaseadvisors.com > > > > > > > > > > > > > > _______________________________________________ > > dba-SQLServer mailing list > > dba-SQLServer at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > http://www.databaseadvisors.com > > > > > > _______________________________________________ > > dba-SQLServer mailing list > > dba-SQLServer at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > http://www.databaseadvisors.com > > > > > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From jwcolby at colbyconsulting.com Mon May 23 05:41:57 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Mon, 23 May 2011 06:41:57 -0400 Subject: [dba-SQLServer] Views don't sort In-Reply-To: References: <4DD69E94.5000100@colbyconsulting.com> <4DD6D367.19607.1B6A2E6F@stuart.lexacorp.com.pg> <4DD73F76.29589.1D104F40@stuart.lexacorp.com.pg> Message-ID: <4DDA39F5.5070408@colbyconsulting.com> Mark, AFAICT pass through queries are not editable. I am trying to build three specific types of queries. 1) Editable (bound) form queries 2) Uneditable combo queries 3) Uneditable report queries. I am using Access 2K3 for dev and Access 2K7 (runtime) someday soon to be 2K10 (runtime) for general usage. It seems that the top(very large number) works for the moment for returning sorted recordsets. OTOH doing the pass-through trick for doing filtered uneditable queries would work great. John W. Colby www.ColbyConsulting.com On 5/23/2011 4:21 AM, Mark Breen wrote: > Hello All, > > I too have seen SQL Server / Access not return the sorted records. I am > intrigued by Francisco's suggestion to try the 99.99...... options, but I am > in the habit now of never ordering within a view and always ordering when i > select data from a view. > > In the cases where I can use an sproc, then I do not use a view at all, just > include the select that would go in the view in the sproc instead. Then I > can safely sort in the sproc and no worries about the client end. > > John, may I tell you about a trick that I sometimes do, and please exclude > me if you are already doing this. I create a Past Through query in Access, > which as you know, ignores jet and sends the query straight to the source db > (SQL Server in this case). I then programatically change the 'SQL' of the > qdef based on what I want to do. Sometimes, I just call the pass-through > query qpstTemplate. The template bit being the connection string. > > Sometimes I have two, qpstTemplate_ReturnsRecords and > qpstTemplate_NoRecords. The 'returns no records' flag is set in the second > one and I can use that for action sprocs. > > I then set the sql to be *usp_GetCustomers*, then later set it again to * > usp_GetOrdersByOrderDate* > > As a result, I often do not need to sort within Access. As you > instinctively know, asking Jet to do this work is not the right course. Do > you want to let SQL server do the heavy lifting for you. > > Any help? > > thanks > > Mark > > > > On 21 May 2011 10:33, Asger Blond wrote: > >> Thanks for the explanation, Stuart. Still I've never seen the result you >> indicate. The TOP 100 PERCENT is a special case where the query engine will >> ignore the ordering specified since you are actually requesting all rows. >> But if you force the engine to make a selection using TOP 99.999999999 >> PERCENT then it makes no sense to me why the engine should not return the >> rows in the order it's being forced to use for the selection. And certainly >> if you use TOP 5 it would be quite inefficient for the engine not to return >> the ordered rows. So: when the engine is forced to use a condition (TOP 5 or >> TOP 99.999999999) I've never seen a situation where the rows are not >> returned in the order specified by the query - whether this is embedded in a >> view or just run as a plain query. >> Asger >> >> -----Oprindelig meddelelse----- >> Fra: dba-sqlserver-bounces at databaseadvisors.com [mailto: >> dba-sqlserver-bounces at databaseadvisors.com] P? vegne af Stuart McLachlan >> Sendt: 21. maj 2011 06:29 >> Til: Discussion concerning MS SQL Server >> Emne: Re: [dba-SQLServer] Views don't sort >> >> It means that if you specify "SELECT TOP 5 FROM ALPHABET ORDER BY LETTER", >> you >> will always get A,B,C,D and E, but they may not necessarily be in that >> order. They may be >> returned as "E,D,C,B,A", "D,B,A,E,C" etc. >> >> Although it has worked up til now, it is just like any other hack that uses >> "undocumented >> features". - after the next patch, hotfix or service pack, you may find >> that it no longer works >> that way - the same records could be returned in a completely different >> sort order, possibly by >> PK or by the order in which they are physically stored on disk. >> >> -- >> Stuart >> >> On 21 May 2011 at 0:09, Asger Blond wrote: >> >>> Well, and this quote from BOL just doesn't make any sense to me. The >>> TOP and ORDER BY clause is used to "determine the rows returned", but >>> it "does not guarantee ordered results" - WTF does this mean? I use >>> the construct specified by Francisco, and have never seen problems. >>> Asger >>> >>> -----Oprindelig meddelelse----- >>> Fra: dba-sqlserver-bounces at databaseadvisors.com >>> [mailto:dba-sqlserver-bounces at databaseadvisors.com] P? vegne af >>> Stuart McLachlan Sendt: 20. maj 2011 22:48 Til: Discussion concerning >>> MS SQL Server Emne: Re: [dba-SQLServer] Views don't sort >>> >>> Be careful with that. It is not guaranteed to work! >>> >>> See http://msdn.microsoft.com/en-us/library/ms188385.aspx >>> >>> The ORDER BY clause is not valid in views, inline functions, derived >>> tables, and subqueries, unless TOP is also specified. ... When ORDER >>> BY is used in the definition of a view, inline function, derived >>> table, or subquery, the clause is used only to determine the rows >>> returned by the TOP clause. The ORDER BY clause does not guarantee >>> ordered results when these constructs are queried, unless ORDER BY is >>> also specified in the query itself >>> >>> The only way to be sure is to use "Select * from vwMyView Order by >>> colMyCol" >>> >>> -- >>> Stuart >>> >>> On 20 May 2011 at 13:31, jwcolby wrote: >>> >>>> Francisco, >>>> >>>> I apparently ignored your top 99.999% part. >>>> >>>> When I went back in to my view and selected top 1 million (very big) >>>> it did in fact return a sorted data set. >>>> >>>> Thanks! >>>> >>>> John W. Colby >>>> www.ColbyConsulting.com >>>> >>>> On 5/20/2011 1:07 PM, Francisco Tapia wrote: >>>>> So something like: >>>>> >>>>> Create View vwSomeView AS >>>>> Select TOP 99.9999 percent Field1, Field2, Field3 >>>>>> From tblSomeTable >>>>> Order by Field3 >>>>> >>>>> does not sort field3? what are your results when you just select >>>>> * from vwSomeView ? are the results sorted in your results >>>>> display in management studio? >>>>> >>>>> >>>>> -Francisco >>>>> >>>>> >>>>> >>>>> >>>>> On Fri, May 20, 2011 at 10:02 AM, >>>>> jwcolbywrote: >>>>> >>>>>> One of the things I am trying to do is use SQL Server to speed up >>>>>> my applications. The theory is that I can hand off the heavy >>>>>> lifting to SQL Server and just get back result sets. Of course >>>>>> this works in terms of joins and filters in a view, but even >>>>>> though I specify a sort in a view, when the result set hits the >>>>>> other end (Access in my case) it is unsorted. >>>>>> >>>>>> Views have the ability to do sorts, so why is the data returned >>>>>> by a view into a third party app, or even into another view in >>>>>> SQL Server unsorted? >>>>>> Is there a way to tell sql server to return sorted data? >>>>>> >>>>>> >>>>>> >>>>> _______________________________________________ >>>>> dba-SQLServer mailing list >>>>> dba-SQLServer at databaseadvisors.com >>>>> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >>>>> http://www.databaseadvisors.com >>>>> >>>>> >>>> _______________________________________________ >>>> dba-SQLServer mailing list >>>> dba-SQLServer at databaseadvisors.com >>>> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >>>> http://www.databaseadvisors.com >>>> >>>> >>> >>> >>> >>> _______________________________________________ >>> dba-SQLServer mailing list >>> dba-SQLServer at databaseadvisors.com >>> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >>> http://www.databaseadvisors.com >>> >>> >>> _______________________________________________ >>> dba-SQLServer mailing list >>> dba-SQLServer at databaseadvisors.com >>> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >>> http://www.databaseadvisors.com >>> >> >> >> >> >> _______________________________________________ >> dba-SQLServer mailing list >> dba-SQLServer at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >> http://www.databaseadvisors.com >> >> >> _______________________________________________ >> dba-SQLServer mailing list >> dba-SQLServer at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >> http://www.databaseadvisors.com >> >> > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From fuller.artful at gmail.com Mon May 23 13:25:40 2011 From: fuller.artful at gmail.com (Arthur Fuller) Date: Mon, 23 May 2011 14:25:40 -0400 Subject: [dba-SQLServer] Attach a database without its log file Message-ID: Is it possible to attach a database without its log file? It occurred to me that I could create an empty database, then copy its log file to a new name, then attach the database, but I haven't tried it yet. TIA, Arthur From jwcolby at colbyconsulting.com Mon May 23 13:55:19 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Mon, 23 May 2011 14:55:19 -0400 Subject: [dba-SQLServer] Attach a database without its log file In-Reply-To: References: Message-ID: <4DDAAD97.1000104@colbyconsulting.com> yep, it creates a new one. John W. Colby www.ColbyConsulting.com On 5/23/2011 2:25 PM, Arthur Fuller wrote: > Is it possible to attach a database without its log file? It occurred to me > that I could create an empty database, then copy its log file to a new name, > then attach the database, but I haven't tried it yet. > > TIA, > Arthur > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From marklbreen at gmail.com Tue May 24 05:29:36 2011 From: marklbreen at gmail.com (Mark Breen) Date: Tue, 24 May 2011 11:29:36 +0100 Subject: [dba-SQLServer] Attach a database without its log file In-Reply-To: <4DDAAD97.1000104@colbyconsulting.com> References: <4DDAAD97.1000104@colbyconsulting.com> Message-ID: Hello Arthur / John And it is a great way to truncate the huge log file. I use this trick all the time. just detach the db, then rename or delete the log file and then re-attach the db, and tell the GUI attach dialog to remove the 'missing' log file. Hey presto you have a nice small log file again Mark On 23 May 2011 19:55, jwcolby wrote: > yep, it creates a new one. > > John W. Colby > www.ColbyConsulting.com > > > On 5/23/2011 2:25 PM, Arthur Fuller wrote: > >> Is it possible to attach a database without its log file? It occurred to >> me >> that I could create an empty database, then copy its log file to a new >> name, >> then attach the database, but I haven't tried it yet. >> >> TIA, >> Arthur >> _______________________________________________ >> dba-SQLServer mailing list >> dba-SQLServer at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >> http://www.databaseadvisors.com >> >> >> _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From marklbreen at gmail.com Tue May 24 05:30:54 2011 From: marklbreen at gmail.com (Mark Breen) Date: Tue, 24 May 2011 11:30:54 +0100 Subject: [dba-SQLServer] Fwd: Views don't sort In-Reply-To: References: <4DD69E94.5000100@colbyconsulting.com> <4DD6D367.19607.1B6A2E6F@stuart.lexacorp.com.pg> <4DD73F76.29589.1D104F40@stuart.lexacorp.com.pg> <4DDA39F5.5070408@colbyconsulting.com> Message-ID: Hello John, Yes, if you want to update your data, you will either have to write update statements or jump through some other hoops such as 1) download the subset of records to Jet that you want to update 2) Bind your subset Jet table to a form and make you bound updates, setting a special column you name as "UpdatedInJet" 3) when all bound updates are complete call an sproc or raw SQL to update the records in the server that Jet bound forms allowed you to update. It sounds like a hack, but it may transpire you can code is all in 20 mins. IMO, you could make you use both strengths with a solution like this. IE, SQL does the heavy work and your bound forms in jet do the heavy coding. Any help? Mark Anyway, in case that it helps with the use case, here is a snippit of my code. As you can see, I use a previously created qpst to call any sproc (or any other sql for that matter), with any params I want or need to do. It means that for Selecting Data, I never ask Jet to do any heavy lifting. Sub S_Logging(strMsg As String) Dim qdef As QueryDef Set qdef = CurrentDb.QueryDefs("qpstLogging") qdef.SQL = "usp_MB_Logging '" & strMsg & "'" DoCmd.OpenQuery ("qpstLogging") End Sub On 23 May 2011 11:41, jwcolby wrote: > Mark, > > AFAICT pass through queries are not editable. I am trying to build three > specific types of queries. > > 1) Editable (bound) form queries > 2) Uneditable combo queries > 3) Uneditable report queries. > > I am using Access 2K3 for dev and Access 2K7 (runtime) someday soon to be > 2K10 (runtime) for general usage. > > It seems that the top(very large number) works for the moment for returning > sorted recordsets. OTOH doing the pass-through trick for doing filtered > uneditable queries would work great. > > > John W. Colby > www.ColbyConsulting.com > > From fuller.artful at gmail.com Tue May 24 05:45:49 2011 From: fuller.artful at gmail.com (Arthur Fuller) Date: Tue, 24 May 2011 06:45:49 -0400 Subject: [dba-SQLServer] Attach a database without its log file In-Reply-To: References: <4DDAAD97.1000104@colbyconsulting.com> Message-ID: Yup. It worked like a charm. All my old databases are now attached. A. On Tue, May 24, 2011 at 6:29 AM, Mark Breen wrote: > Hello Arthur / John > > And it is a great way to truncate the huge log file. I use this trick all > the time. > > just detach the db, then rename or delete the log file and then re-attach > the db, and tell the GUI attach dialog to remove the 'missing' log file. > Hey presto you have a nice small log file again > > Mark > > From fhtapia at gmail.com Tue May 24 09:46:28 2011 From: fhtapia at gmail.com (Francisco Tapia) Date: Tue, 24 May 2011 07:46:28 -0700 Subject: [dba-SQLServer] Attach a database without its log file In-Reply-To: References: <4DDAAD97.1000104@colbyconsulting.com> Message-ID: Mark, I completely understand that while developing you may only wish to carry around the db file, especially if you are delivering a new database design to a client. What I don't understand is why you would choose to use this method to mitigate log file size in a normal day-to-day scenario? I am having a hard time thinking about what would justify stopping my database to detach it, only to re-attach it just to create a small transaction log file? If while developing you don't want the log file to get out of control you would then configure in enterprise manager (sql server 2000) or management studio (sql server 2005+) your database to be setup with the "Simple" recovery option. This would then bypass storing any changes in the tlog before making it to the database and thus keeping your tlog small to begin with. If you are in a production environment and you ran some might big updates and now need to recover your database size, then why not just use the tools built within sql server? Ideally you would first run a full backup of the database, then backup the log with the truncate only flag, followed by the shrink file command as such: BACKUP LOG myFavoriteDB WITH TRUNCATE_ONLY DBCC SHRINKFILE ('myFavoriteDB_log', 10) Where 10 is the new size in MB of the transaction log. remember ideally in a production environment you'd want the transaction log to be about 10% size of the database file, however there are exceptions. just wondering... -Francisco On Tue, May 24, 2011 at 3:29 AM, Mark Breen wrote: > Hello Arthur / John > > And it is a great way to truncate the huge log file. I use this trick all > the time. > > just detach the db, then rename or delete the log file and then re-attach > the db, and tell the GUI attach dialog to remove the 'missing' log file. > Hey presto you have a nice small log file again > > Mark > > > On 23 May 2011 19:55, jwcolby wrote: > > > yep, it creates a new one. > > > > John W. Colby > > www.ColbyConsulting.com > > > > > > On 5/23/2011 2:25 PM, Arthur Fuller wrote: > > > >> Is it possible to attach a database without its log file? It occurred to > >> me > >> that I could create an empty database, then copy its log file to a new > >> name, > >> then attach the database, but I haven't tried it yet. > >> > >> TIA, > >> Arthur > >> _______________________________________________ > >> dba-SQLServer mailing list > >> dba-SQLServer at databaseadvisors.com > >> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > >> http://www.databaseadvisors.com > >> > >> > >> _______________________________________________ > > dba-SQLServer mailing list > > dba-SQLServer at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > http://www.databaseadvisors.com > > > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From marklbreen at gmail.com Wed May 25 03:30:58 2011 From: marklbreen at gmail.com (Mark Breen) Date: Wed, 25 May 2011 09:30:58 +0100 Subject: [dba-SQLServer] Attach a database without its log file In-Reply-To: References: <4DDAAD97.1000104@colbyconsulting.com> Message-ID: Hi Francisco, Thanks for your response. I have a scientific explanation and also ridiculously silly explanation, I will start with the ridiculous one first. *Ridiculous Explanation* After years of trying to shrink databases, and years of not fully understanding the way the log file works (may not still fully understand it), when I discovered how I could trash the log file, I think I subliminally feel I am taking revenge on all the large log files I had in the past. So this heavy handed approach allows me to show SQL Server transaction logs who is really boss. *More Realistic Explanation* Nowadays, the first thing I do with a db is to switch the recovery option to Simple. It is a solution to years of enormous log files. In the past 15 year however, before either a) I discovered simple recovery mode or b) maybe simple recovery was not in SQL 6.5 / 7.0 I struggled with large log files. As you say, with an important db, the first thing we want to do is to back it up, but with enormous log files, I often struggled to get the db to backup. In the case that the drive was already full, it was even worse. In SQL 7 days, if you recall, there was a special iterative script that we used to run to fill the log file pages to a sufficient extent that we could get it to properly reduce in size. To be honest, I do not use this method to make it easier to carry around db files, actually, to move a db, I always do a backup and restore - should I consider detach and attach ? Is it better? What are the main differences between detaching, copying and attaching vs backing up and copying and restoring ? The main situation I do it is when I have a big log file because I forget to switch to Simple Recovery. I just quickly mentally check I have recent backups - usually I do - and the trash the log file and continue working. As I was writing this, I googled With Truncate Only, and came across this http://sqlserverpedia.com/blog/sql-server-backup-and-restore/backup-log-with-truncate_only-like-a-bear-trap/ Here is the opening paragraph *It?s somewhat akin to asking, ?What?s the best way to cut my hand off to free myself from this bear trap before I starve to death in the wilderness?? Well, you shouldn?t be sticking your hand in bear traps to begin with, but if you find your hand in a bear trap, ANY way to get out of it is a good way. Pocket knife, teeth, band saw, whatever it takes.* Following this email, I intend to experiment with With Truncate Only, but may I ask, is there actually much difference between remove the actualy file and doing a truncate and then a shrink? I suppose the shrink with 10% ensures you save time re-building the file size up to 10%. In summary, after often struggling to shrink a log file, the simplicity of simply removing it and letting SQL Server manage the re-creation really appeals to me. Thanks Mark * * On 24 May 2011 15:46, Francisco Tapia wrote: > Mark, > I completely understand that while developing you may only wish to carry > around the db file, especially if you are delivering a new database design > to a client. What I don't understand is why you would choose to use this > method to mitigate log file size in a normal day-to-day scenario? I am > having a hard time thinking about what would justify stopping my database > to > detach it, only to re-attach it just to create a small transaction log > file? > > If while developing you don't want the log file to get out of control you > would then configure in enterprise manager (sql server 2000) or management > studio (sql server 2005+) your database to be setup with the "Simple" > recovery option. This would then bypass storing any changes in the tlog > before making it to the database and thus keeping your tlog small to begin > with. > > If you are in a production environment and you ran some might big updates > and now need to recover your database size, then why not just use the tools > built within sql server? Ideally you would first run a full backup of the > database, then backup the log with the truncate only flag, followed by the > shrink file command as such: > > BACKUP LOG myFavoriteDB WITH TRUNCATE_ONLY > DBCC SHRINKFILE ('myFavoriteDB_log', 10) > > Where 10 is the new size in MB of the transaction log. remember ideally in > a production environment you'd want the transaction log to be about 10% > size > of the database file, however there are exceptions. > > > just wondering... > -Francisco > > > On Tue, May 24, 2011 at 3:29 AM, Mark Breen wrote: > > > Hello Arthur / John > > > > And it is a great way to truncate the huge log file. I use this trick > all > > the time. > > > > just detach the db, then rename or delete the log file and then re-attach > > the db, and tell the GUI attach dialog to remove the 'missing' log file. > > Hey presto you have a nice small log file again > > > > Mark > > > > > > On 23 May 2011 19:55, jwcolby wrote: > > > > > yep, it creates a new one. > > > > > > John W. Colby > > > www.ColbyConsulting.com > > > > > > > > > On 5/23/2011 2:25 PM, Arthur Fuller wrote: > > > > > >> Is it possible to attach a database without its log file? It occurred > to > > >> me > > >> that I could create an empty database, then copy its log file to a new > > >> name, > > >> then attach the database, but I haven't tried it yet. > > >> > > >> TIA, > > >> Arthur > > >> _______________________________________________ > > >> dba-SQLServer mailing list > > >> dba-SQLServer at databaseadvisors.com > > >> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > >> http://www.databaseadvisors.com > > >> > > >> > > >> _______________________________________________ > > > dba-SQLServer mailing list > > > dba-SQLServer at databaseadvisors.com > > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > > http://www.databaseadvisors.com > > > > > > > > _______________________________________________ > > dba-SQLServer mailing list > > dba-SQLServer at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > http://www.databaseadvisors.com > > > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From Robert at WeBeDb.com Wed May 25 09:30:59 2011 From: Robert at WeBeDb.com (Robert) Date: Wed, 25 May 2011 09:30:59 -0500 Subject: [dba-SQLServer] Views don't sort In-Reply-To: References: Message-ID: <7CE49A34-194F-4B4D-B0E1-DA0F10ADCB6A@holly.arvixe.com> John, The minute you raid uneditable, you should be using a stored procedure and a pass through query. For editable, your choices are views with the PK included or the tables, the first being the preference. BTW...The non-sort behavior started with 2005. Robert At 05:31 AM 5/24/2011, you wrote: >From: jwcolby >To: Discussion concerning MS SQL Server > >Subject: Re: [dba-SQLServer] Views don't sort >Message-ID: <4DDA39F5.5070408 at colbyconsulting.com> >Content-Type: text/plain; charset=ISO-8859-1; format=flowed > >Mark, > >AFAICT pass through queries are not editable. I am trying to build >three specific types of queries. > >1) Editable (bound) form queries >2) Uneditable combo queries >3) Uneditable report queries. > >I am using Access 2K3 for dev and Access 2K7 (runtime) someday soon >to be 2K10 (runtime) for general >usage. > >It seems that the top(very large number) works for the moment for >returning sorted recordsets. OTOH >doing the pass-through trick for doing filtered uneditable queries >would work great. > >John W. Colby >www.ColbyConsulting.com From fuller.artful at gmail.com Sun May 15 10:10:48 2011 From: fuller.artful at gmail.com (Arthur Fuller) Date: Sun, 15 May 2011 15:10:48 -0000 Subject: [dba-SQLServer] Problems finding SQL Server Message-ID: Lately I've been rebuilding my main box. It's running Windows 7 Ultimate 64-bit, and SQL 2008 Enterprise 64-bit.The SQL installation seemed to go perfectly, but when I try to run Management Studio I am unable to connect. I get a message saying "a network or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remove connections. (provider:Named Pipes Provider, error: 40 - Could not open a connection to SQL Server, error: 2). This I can however open From fhtapia at gmail.com Tue May 24 09:51:06 2011 From: fhtapia at gmail.com (Francisco Tapia) Date: Tue, 24 May 2011 07:51:06 -0700 Subject: [dba-SQLServer] Views don't sort In-Reply-To: <4DDA39F5.5070408@colbyconsulting.com> References: <4DD69E94.5000100@colbyconsulting.com> <4DD6D367.19607.1B6A2E6F@stuart.lexacorp.com.pg> <4DD73F76.29589.1D104F40@stuart.lexacorp.com.pg> <4DDA39F5.5070408@colbyconsulting.com> Message-ID: John, Having worked between Access and Sql Server for a long time, I can tell you that what you are trying to do is many times do-able when your Access front end is an "Access Data Project" vs a normal Access Database. and the "bound" methods that you normally use are still available. Though, you will need to jump a whole new set of hoops just to make your bound forms work as you wanted. Let's not mistake this as a "bound vs unbound" unholy war, but I'm just saying. There may be a need for you to extend your framework to handle this situations so that you can leverage your "bound" project. -Francisco http://bit.ly/sqlthis | Tsql and More... http://db.tt/JeXURAx | Drop Box, Storage in the Cloud (free) On Mon, May 23, 2011 at 3:41 AM, jwcolby wrote: > Mark, > > AFAICT pass through queries are not editable. I am trying to build three > specific types of queries. > > 1) Editable (bound) form queries > 2) Uneditable combo queries > 3) Uneditable report queries. > > I am using Access 2K3 for dev and Access 2K7 (runtime) someday soon to be > 2K10 (runtime) for general usage. > > It seems that the top(very large number) works for the moment for returning > sorted recordsets. OTOH doing the pass-through trick for doing filtered > uneditable queries would work great. > > > John W. Colby > www.ColbyConsulting.com > > On 5/23/2011 4:21 AM, Mark Breen wrote: > >> Hello All, >> >> I too have seen SQL Server / Access not return the sorted records. I am >> intrigued by Francisco's suggestion to try the 99.99...... options, but I >> am >> in the habit now of never ordering within a view and always ordering when >> i >> select data from a view. >> >> In the cases where I can use an sproc, then I do not use a view at all, >> just >> include the select that would go in the view in the sproc instead. Then I >> can safely sort in the sproc and no worries about the client end. >> >> John, may I tell you about a trick that I sometimes do, and please exclude >> me if you are already doing this. I create a Past Through query in >> Access, >> which as you know, ignores jet and sends the query straight to the source >> db >> (SQL Server in this case). I then programatically change the 'SQL' of the >> qdef based on what I want to do. Sometimes, I just call the pass-through >> query qpstTemplate. The template bit being the connection string. >> >> Sometimes I have two, qpstTemplate_ReturnsRecords and >> qpstTemplate_NoRecords. The 'returns no records' flag is set in the >> second >> one and I can use that for action sprocs. >> >> I then set the sql to be *usp_GetCustomers*, then later set it again to * >> usp_GetOrdersByOrderDate* >> >> As a result, I often do not need to sort within Access. As you >> instinctively know, asking Jet to do this work is not the right course. >> Do >> you want to let SQL server do the heavy lifting for you. >> >> Any help? >> >> thanks >> >> Mark >> >> >> >> On 21 May 2011 10:33, Asger Blond wrote: >> >> Thanks for the explanation, Stuart. Still I've never seen the result you >>> indicate. The TOP 100 PERCENT is a special case where the query engine >>> will >>> ignore the ordering specified since you are actually requesting all rows. >>> But if you force the engine to make a selection using TOP 99.999999999 >>> PERCENT then it makes no sense to me why the engine should not return the >>> rows in the order it's being forced to use for the selection. And >>> certainly >>> if you use TOP 5 it would be quite inefficient for the engine not to >>> return >>> the ordered rows. So: when the engine is forced to use a condition (TOP 5 >>> or >>> TOP 99.999999999) I've never seen a situation where the rows are not >>> returned in the order specified by the query - whether this is embedded >>> in a >>> view or just run as a plain query. >>> Asger >>> >>> -----Oprindelig meddelelse----- >>> Fra: dba-sqlserver-bounces at databaseadvisors.com [mailto: >>> dba-sqlserver-bounces at databaseadvisors.com] P? vegne af Stuart McLachlan >>> Sendt: 21. maj 2011 06:29 >>> Til: Discussion concerning MS SQL Server >>> Emne: Re: [dba-SQLServer] Views don't sort >>> >>> It means that if you specify "SELECT TOP 5 FROM ALPHABET ORDER BY >>> LETTER", >>> you >>> will always get A,B,C,D and E, but they may not necessarily be in that >>> order. They may be >>> returned as "E,D,C,B,A", "D,B,A,E,C" etc. >>> >>> Although it has worked up til now, it is just like any other hack that >>> uses >>> "undocumented >>> features". - after the next patch, hotfix or service pack, you may find >>> that it no longer works >>> that way - the same records could be returned in a completely different >>> sort order, possibly by >>> PK or by the order in which they are physically stored on disk. >>> >>> -- >>> Stuart >>> >>> On 21 May 2011 at 0:09, Asger Blond wrote: >>> >>> Well, and this quote from BOL just doesn't make any sense to me. The >>>> TOP and ORDER BY clause is used to "determine the rows returned", but >>>> it "does not guarantee ordered results" - WTF does this mean? I use >>>> the construct specified by Francisco, and have never seen problems. >>>> Asger >>>> >>>> -----Oprindelig meddelelse----- >>>> Fra: dba-sqlserver-bounces at databaseadvisors.com >>>> [mailto:dba-sqlserver-bounces at databaseadvisors.com] P? vegne af >>>> Stuart McLachlan Sendt: 20. maj 2011 22:48 Til: Discussion concerning >>>> MS SQL Server Emne: Re: [dba-SQLServer] Views don't sort >>>> >>>> Be careful with that. It is not guaranteed to work! >>>> >>>> See http://msdn.microsoft.com/en-us/library/ms188385.aspx >>>> >>>> The ORDER BY clause is not valid in views, inline functions, derived >>>> tables, and subqueries, unless TOP is also specified. ... When ORDER >>>> BY is used in the definition of a view, inline function, derived >>>> table, or subquery, the clause is used only to determine the rows >>>> returned by the TOP clause. The ORDER BY clause does not guarantee >>>> ordered results when these constructs are queried, unless ORDER BY is >>>> also specified in the query itself >>>> >>>> The only way to be sure is to use "Select * from vwMyView Order by >>>> colMyCol" >>>> >>>> -- >>>> Stuart >>>> >>>> On 20 May 2011 at 13:31, jwcolby wrote: >>>> >>>> Francisco, >>>>> >>>>> I apparently ignored your top 99.999% part. >>>>> >>>>> When I went back in to my view and selected top 1 million (very big) >>>>> it did in fact return a sorted data set. >>>>> >>>>> Thanks! >>>>> >>>>> John W. Colby >>>>> www.ColbyConsulting.com >>>>> >>>>> On 5/20/2011 1:07 PM, Francisco Tapia wrote: >>>>> >>>>>> So something like: >>>>>> >>>>>> Create View vwSomeView AS >>>>>> Select TOP 99.9999 percent Field1, Field2, Field3 >>>>>> >>>>>>> From tblSomeTable >>>>>>> >>>>>> Order by Field3 >>>>>> >>>>>> does not sort field3? what are your results when you just select >>>>>> * from vwSomeView ? are the results sorted in your results >>>>>> display in management studio? >>>>>> >>>>>> >>>>>> -Francisco >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> On Fri, May 20, 2011 at 10:02 AM, >>>>>> jwcolbywrote: >>>>>> >>>>>> One of the things I am trying to do is use SQL Server to speed up >>>>>>> my applications. The theory is that I can hand off the heavy >>>>>>> lifting to SQL Server and just get back result sets. Of course >>>>>>> this works in terms of joins and filters in a view, but even >>>>>>> though I specify a sort in a view, when the result set hits the >>>>>>> other end (Access in my case) it is unsorted. >>>>>>> >>>>>>> Views have the ability to do sorts, so why is the data returned >>>>>>> by a view into a third party app, or even into another view in >>>>>>> SQL Server unsorted? >>>>>>> Is there a way to tell sql server to return sorted data? >>>>>>> >>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>> dba-SQLServer mailing list >>>>>> dba-SQLServer at databaseadvisors.com >>>>>> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >>>>>> http://www.databaseadvisors.com >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>> dba-SQLServer mailing list >>>>> dba-SQLServer at databaseadvisors.com >>>>> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >>>>> http://www.databaseadvisors.com >>>>> >>>>> >>>>> >>>> >>>> >>>> _______________________________________________ >>>> dba-SQLServer mailing list >>>> dba-SQLServer at databaseadvisors.com >>>> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >>>> http://www.databaseadvisors.com >>>> >>>> >>>> _______________________________________________ >>>> dba-SQLServer mailing list >>>> dba-SQLServer at databaseadvisors.com >>>> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >>>> http://www.databaseadvisors.com >>>> >>>> >>> >>> >>> >>> _______________________________________________ >>> dba-SQLServer mailing list >>> dba-SQLServer at databaseadvisors.com >>> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >>> http://www.databaseadvisors.com >>> >>> >>> _______________________________________________ >>> dba-SQLServer mailing list >>> dba-SQLServer at databaseadvisors.com >>> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >>> http://www.databaseadvisors.com >>> >>> >>> _______________________________________________ >> dba-SQLServer mailing list >> dba-SQLServer at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >> http://www.databaseadvisors.com >> >> >> _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From jwcolby at colbyconsulting.com Mon May 2 15:27:21 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Mon, 02 May 2011 16:27:21 -0400 Subject: [dba-SQLServer] SQL Server - Append records without fail Message-ID: <4DBF13A9.9080503@colbyconsulting.com> In access you can append records into a table and if a given record fails, the rest go in. I use that as a quick and dirty filter sometimes when (for example) appending records from one place to another. AFAICT SQL Server will not append any of the records if any single record fails to append, which has always seemed strange to me. It's almost like an unrequested rollback. Is there any way to make SQL Server accept the appends that will go in and only reject the ones that will not for some reason? -- John W. Colby www.ColbyConsulting.com From ab-mi at post3.tele.dk Mon May 2 16:18:36 2011 From: ab-mi at post3.tele.dk (Asger Blond) Date: Mon, 2 May 2011 23:18:36 +0200 Subject: [dba-SQLServer] SQL Server - Append records without fail In-Reply-To: <4DBF13A9.9080503@colbyconsulting.com> References: <4DBF13A9.9080503@colbyconsulting.com> Message-ID: <71345C412B464389BAD067771E90DB06@abpc> John, If the unique index is created with the option IGNORE_DUP_KEY then the behaviour will be the same as in Access. Asger -----Oprindelig meddelelse----- Fra: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] P? vegne af jwcolby Sendt: 2. maj 2011 22:27 Til: Access Developers discussion and problem solving; Sqlserver-Dba Emne: [dba-SQLServer] SQL Server - Append records without fail In access you can append records into a table and if a given record fails, the rest go in. I use that as a quick and dirty filter sometimes when (for example) appending records from one place to another. AFAICT SQL Server will not append any of the records if any single record fails to append, which has always seemed strange to me. It's almost like an unrequested rollback. Is there any way to make SQL Server accept the appends that will go in and only reject the ones that will not for some reason? -- John W. Colby www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Mon May 2 16:23:37 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Mon, 02 May 2011 17:23:37 -0400 Subject: [dba-SQLServer] SQL Server - Append records without fail In-Reply-To: <71345C412B464389BAD067771E90DB06@abpc> References: <4DBF13A9.9080503@colbyconsulting.com> <71345C412B464389BAD067771E90DB06@abpc> Message-ID: <4DBF20D9.1090805@colbyconsulting.com> OK, good to know! Thanks, John W. Colby www.ColbyConsulting.com On 5/2/2011 5:18 PM, Asger Blond wrote: > John, > If the unique index is created with the option IGNORE_DUP_KEY then the behaviour will be the same as in Access. > Asger > > -----Oprindelig meddelelse----- > Fra: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] P? vegne af jwcolby > Sendt: 2. maj 2011 22:27 > Til: Access Developers discussion and problem solving; Sqlserver-Dba > Emne: [dba-SQLServer] SQL Server - Append records without fail > > In access you can append records into a table and if a given record fails, the rest go in. I use > that as a quick and dirty filter sometimes when (for example) appending records from one place to > another. > > AFAICT SQL Server will not append any of the records if any single record fails to append, which has > always seemed strange to me. It's almost like an unrequested rollback. > > Is there any way to make SQL Server accept the appends that will go in and only reject the ones that > will not for some reason? > From ab-mi at post3.tele.dk Mon May 2 17:12:23 2011 From: ab-mi at post3.tele.dk (Asger Blond) Date: Tue, 3 May 2011 00:12:23 +0200 Subject: [dba-SQLServer] SQL Server - Append records without fail In-Reply-To: <4DBF20D9.1090805@colbyconsulting.com> References: <4DBF13A9.9080503@colbyconsulting.com><71345C412B464389BAD067771E90DB06@abpc> <4DBF20D9.1090805@colbyconsulting.com> Message-ID: And BTW this goes for both plain unique indexes and for primary keys as demonstrated below: -- Unique index: CREATE TABLE T1(C1 int) GO CREATE UNIQUE INDEX UI_C1 on T1(C1) GO INSERT INTO T1 VALUES(3) INSERT INTO T1 VALUES(4) INSERT INTO T1 VALUES(5) INSERT INTO T1 VALUES(6) GO CREATE TABLE T2(C1 int) GO INSERT INTO T2 VALUES(1) INSERT INTO T2 VALUES(2) INSERT INTO T2 VALUES(3) INSERT INTO T2 VALUES(4) INSERT INTO T2 VALUES(7) GO INSERT INTO T1 SELECT C1 FROM T2 -->Error SELECT * FROM T1-->All inserts cancelled GO ALTER INDEX UI_C1 ON T1 REBUILD WITH (IGNORE_DUP_KEY = ON) GO INSERT INTO T1 SELECT C1 FROM T2 -->Warning: Duplicate key was ignored SELECT * FROM T1-->All inserts succeeded except for those creating key-duplicates, behaviour as in Access -- Primary key: CREATE TABLE T3(C1 int CONSTRAINT PK_C1 PRIMARY KEY) GO INSERT INTO T3 VALUES(3) INSERT INTO T3 VALUES(4) INSERT INTO T3 VALUES(5) INSERT INTO T3 VALUES(6) GO INSERT INTO T3 SELECT C1 FROM T2 -->Error SELECT * FROM T3-->All inserts cancelled GO ALTER TABLE T3 DROP CONSTRAINT PK_C1 GO ALTER TABLE T3 ADD CONSTRAINT PK_C1 PRIMARY KEY (C1) WITH (IGNORE_DUP_KEY = ON) GO INSERT INTO T3 SELECT C1 FROM T2 -->Warning: Duplicate key was ignored SELECT * FROM T3-->All inserts succeeded except for those creating key-duplicates, behaviour as in Access Asger -----Oprindelig meddelelse----- Fra: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] P? vegne af jwcolby Sendt: 2. maj 2011 23:24 Til: Discussion concerning MS SQL Server Emne: Re: [dba-SQLServer] SQL Server - Append records without fail OK, good to know! Thanks, John W. Colby www.ColbyConsulting.com On 5/2/2011 5:18 PM, Asger Blond wrote: > John, > If the unique index is created with the option IGNORE_DUP_KEY then the behaviour will be the same as in Access. > Asger > > -----Oprindelig meddelelse----- > Fra: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] P? vegne af jwcolby > Sendt: 2. maj 2011 22:27 > Til: Access Developers discussion and problem solving; Sqlserver-Dba > Emne: [dba-SQLServer] SQL Server - Append records without fail > > In access you can append records into a table and if a given record fails, the rest go in. I use > that as a quick and dirty filter sometimes when (for example) appending records from one place to > another. > > AFAICT SQL Server will not append any of the records if any single record fails to append, which has > always seemed strange to me. It's almost like an unrequested rollback. > > Is there any way to make SQL Server accept the appends that will go in and only reject the ones that > will not for some reason? > _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Thu May 12 14:28:03 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Thu, 12 May 2011 15:28:03 -0400 Subject: [dba-SQLServer] =?windows-1252?q?LSI_MegaRAID_SAS/SATA_9265-8i_6G?= =?windows-1252?q?b/s_PCIe_RAID_Card_Review_=96_Performance_Unleashed!_=7C?= =?windows-1252?q?_The_SSD_Review?= Message-ID: <4DCC34C3.4080302@colbyconsulting.com> -- John W. Colby www.ColbyConsulting.com http://thessdreview.com/our-reviews/lsi-megaraid-sassata-9265-8i-6gbs-pcie-raid-controller-card-review/ From dbdoug at gmail.com Thu May 12 21:31:49 2011 From: dbdoug at gmail.com (Doug Steele) Date: Thu, 12 May 2011 19:31:49 -0700 Subject: [dba-SQLServer] =?windows-1252?q?LSI_MegaRAID_SAS/SATA_9265-8i_6G?= =?windows-1252?q?b/s_PCIe_RAID_Card_Review_=96_Performance_Unleash?= =?windows-1252?q?ed!_=7C_The_SSD_Review?= In-Reply-To: <4DCC34C3.4080302@colbyconsulting.com> References: <4DCC34C3.4080302@colbyconsulting.com> Message-ID: Impressive. But will it fit in my iPad? Doug On Thu, May 12, 2011 at 12:28 PM, jwcolby wrote: > > -- > John W. Colby > www.ColbyConsulting.com > http://thessdreview.com/our-reviews/lsi-megaraid-sassata-9265-8i-6gbs-pcie-raid-controller-card-review/ > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From fuller.artful at gmail.com Sun May 15 10:37:44 2011 From: fuller.artful at gmail.com (Arthur Fuller) Date: Sun, 15 May 2011 11:37:44 -0400 Subject: [dba-SQLServer] Problem Finding Database Engine Message-ID: Lately I've been rebuilding my main box. It's running Windows 7 Ultimate 64-bit, and SQL 2008 Enterprise 64-bit.The SQL installation seemed to go perfectly, but when I try to run Management Studio I am unable to connect. I get a message saying "a network or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remove connections. (provider:Named Pipes Provider, error: 40 - Could not open a connection to SQL Server, error: 2). This was from trying to connect to Database Engine. However I am able to connect to Analysis Services (which happens to contain no databases at the moment, but at least I can connect). Any idea what might be wrong and how I can fix it? TIA, Arthur From dbdoug at gmail.com Sun May 15 10:46:59 2011 From: dbdoug at gmail.com (Doug Steele) Date: Sun, 15 May 2011 08:46:59 -0700 Subject: [dba-SQLServer] Problem Finding Database Engine In-Reply-To: References: Message-ID: Is the SQL Server service actually running? I had a problem recently where the service, despite being set as 'automatic', failed to load properly when the computer started up. Doug On Sun, May 15, 2011 at 8:37 AM, Arthur Fuller wrote: > Lately I've been rebuilding my main box. It's running Windows 7 Ultimate > 64-bit, and SQL 2008 Enterprise 64-bit.The SQL installation seemed to go > perfectly, but when I try to run Management Studio I am unable to connect. I > get a message saying "a network or instance-specific error occurred while > establishing a connection to SQL Server. The server was not found or was not > accessible. Verify that the instance name is correct and that SQL Server is > configured to allow remove connections. (provider:Named Pipes Provider, > error: 40 - Could not open a connection to SQL Server, error: 2). > This was from trying to connect to Database Engine. However I am able to > connect to Analysis Services (which happens to contain no databases at the > moment, but at least I can connect). > > Any idea what might be wrong and how I can fix it? > > TIA, > Arthur > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From fuller.artful at gmail.com Sun May 15 12:32:03 2011 From: fuller.artful at gmail.com (Arthur Fuller) Date: Sun, 15 May 2011 13:32:03 -0400 Subject: [dba-SQLServer] Problem Finding Database Engine In-Reply-To: References: Message-ID: I don't see an item in the service tray indicating that. Also, I can't remember how to invoke the engine manager itself (been on other projects lately and haven't been using SQL lately). Or perhaps it's a KPI of Alzheimers... Arthur On Sun, May 15, 2011 at 11:46 AM, Doug Steele wrote: > Is the SQL Server service actually running? I had a problem recently > where the service, despite being set as 'automatic', failed to load > properly when the computer started up. > > Doug > > From accessd at shaw.ca Sun May 15 14:10:24 2011 From: accessd at shaw.ca (Jim Lawrence) Date: Sun, 15 May 2011 12:10:24 -0700 Subject: [dba-SQLServer] Problem Finding Database Engine In-Reply-To: References: Message-ID: Hi Arthur: Ran into a similar issue the other day after installing MS SQL 2008 64bit. Unlike other MS SQL versions all connect protocols are turned off by default; no TCP/IP, Named Pipes etc. I spent the better part of a couple of hours to find the spot to turn everything on. It may seem something stupid but it sure had me confused for a bit. I just kept testing with the ODBC manager until the server lit up. HTH Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller Sent: Sunday, May 15, 2011 8:38 AM To: Discussion concerning MS SQL Server Subject: [dba-SQLServer] Problem Finding Database Engine Lately I've been rebuilding my main box. It's running Windows 7 Ultimate 64-bit, and SQL 2008 Enterprise 64-bit.The SQL installation seemed to go perfectly, but when I try to run Management Studio I am unable to connect. I get a message saying "a network or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remove connections. (provider:Named Pipes Provider, error: 40 - Could not open a connection to SQL Server, error: 2). This was from trying to connect to Database Engine. However I am able to connect to Analysis Services (which happens to contain no databases at the moment, but at least I can connect). Any idea what might be wrong and how I can fix it? TIA, Arthur _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From mwp.reid at qub.ac.uk Sun May 15 14:13:44 2011 From: mwp.reid at qub.ac.uk (Martin Reid) Date: Sun, 15 May 2011 20:13:44 +0100 Subject: [dba-SQLServer] Problem Finding Database Engine In-Reply-To: References: , Message-ID: <631CF83223105545BF43EFB52CB082954924E6DA59@EX2K7-VIRT-2.ads.qub.ac.uk> Hi Arthur Have a look at surface area configuration/management and make sure enable remote connections is checked as well as all the required protocols. Martin Martin WP Reid Information Services The McClay Library Queen's University of Belfast 10 College Park Belfast BT7 1LP Tel : 02890976174 Email : mwp.reid at qub.ac.uk Sharepoint Training Portal ________________________________________ From: dba-sqlserver-bounces at databaseadvisors.com [dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence [accessd at shaw.ca] Sent: 15 May 2011 20:10 To: 'Discussion concerning MS SQL Server' Subject: Re: [dba-SQLServer] Problem Finding Database Engine Hi Arthur: Ran into a similar issue the other day after installing MS SQL 2008 64bit. Unlike other MS SQL versions all connect protocols are turned off by default; no TCP/IP, Named Pipes etc. I spent the better part of a couple of hours to find the spot to turn everything on. It may seem something stupid but it sure had me confused for a bit. I just kept testing with the ODBC manager until the server lit up. HTH Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller Sent: Sunday, May 15, 2011 8:38 AM To: Discussion concerning MS SQL Server Subject: [dba-SQLServer] Problem Finding Database Engine Lately I've been rebuilding my main box. It's running Windows 7 Ultimate 64-bit, and SQL 2008 Enterprise 64-bit.The SQL installation seemed to go perfectly, but when I try to run Management Studio I am unable to connect. I get a message saying "a network or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remove connections. (provider:Named Pipes Provider, error: 40 - Could not open a connection to SQL Server, error: 2). This was from trying to connect to Database Engine. However I am able to connect to Analysis Services (which happens to contain no databases at the moment, but at least I can connect). Any idea what might be wrong and how I can fix it? TIA, Arthur _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From dbdoug at gmail.com Sun May 15 14:15:07 2011 From: dbdoug at gmail.com (Doug Steele) Date: Sun, 15 May 2011 12:15:07 -0700 Subject: [dba-SQLServer] Problem Finding Database Engine In-Reply-To: References: Message-ID: Hi Arthur: You need to use the management console. In Windows 7, Control Panel then System and Security then Administrative Tools then Computer Management then Services and Applications then Services. In the list of services look for 'SQL Server'. The Status should be 'Started' and the Startup Type should be Automatic. If the Status isn't 'Started' then you can start it by right clicking on the name and selecting 'Start'. If the Startup Type is Automatic and it won't start when you boot the computer, you have to look at the system logs to find out why it's failing. I'll send more info if you need it. Doug On Sun, May 15, 2011 at 10:32 AM, Arthur Fuller wrote: > I don't see an item in the service tray indicating that. Also, I can't > remember how to invoke the engine manager itself (been on other projects > lately and haven't been using SQL lately). Or perhaps it's a KPI of > Alzheimers... > > Arthur > > On Sun, May 15, 2011 at 11:46 AM, Doug Steele wrote: > >> Is the SQL Server service actually running? ?I had a problem recently >> where the service, despite being set as 'automatic', failed to load >> properly when the computer started up. >> >> Doug >> >> > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From df.waters at comcast.net Sun May 15 14:25:44 2011 From: df.waters at comcast.net (Dan Waters) Date: Sun, 15 May 2011 14:25:44 -0500 Subject: [dba-SQLServer] Problem Finding Database Engine In-Reply-To: References: Message-ID: <002f01cc1335$e36fef60$aa4fce20$@comcast.net> Hi Arthur, I've always connected via TCP/IP. IIRC, Management Studio is a remote connection to SQL Server, even on the same PC. Because only TCP/IP handles remote requests, that's what must be used to be able to connect with Management Studio (and probably Visual Studio as well). Under administrative, go to the Computer Management control panel. At the bottom open up Services and Applications. Then you'll see SQL Server Configuration Manager. Now you'll see SQL Server Network Configuration - open that and then open Protocols for SQL Server. You'll see the list of protocols - enable TCP/IP and disable the others. You may also see SQL Native Client 10.0 Configuration. Open that and then open Client Protocols. Again you'll see the list of protocols - enable TCP/IP and disable the others. Hope that works! Dan -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller Sent: Sunday, May 15, 2011 10:38 AM To: Discussion concerning MS SQL Server Subject: [dba-SQLServer] Problem Finding Database Engine Lately I've been rebuilding my main box. It's running Windows 7 Ultimate 64-bit, and SQL 2008 Enterprise 64-bit.The SQL installation seemed to go perfectly, but when I try to run Management Studio I am unable to connect. I get a message saying "a network or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remove connections. (provider:Named Pipes Provider, error: 40 - Could not open a connection to SQL Server, error: 2). This was from trying to connect to Database Engine. However I am able to connect to Analysis Services (which happens to contain no databases at the moment, but at least I can connect). Any idea what might be wrong and how I can fix it? TIA, Arthur _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Sun May 15 20:34:50 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sun, 15 May 2011 21:34:50 -0400 Subject: [dba-SQLServer] Problem Finding Database Engine In-Reply-To: References: Message-ID: <4DD07F3A.8070202@colbyconsulting.com> You need to go into services and see if the service is running. You will not see it in the application tray. John W. Colby www.ColbyConsulting.com On 5/15/2011 1:32 PM, Arthur Fuller wrote: > I don't see an item in the service tray indicating that. Also, I can't > remember how to invoke the engine manager itself (been on other projects > lately and haven't been using SQL lately). Or perhaps it's a KPI of > Alzheimers... > > Arthur > > On Sun, May 15, 2011 at 11:46 AM, Doug Steele wrote: > >> Is the SQL Server service actually running? I had a problem recently >> where the service, despite being set as 'automatic', failed to load >> properly when the computer started up. >> >> Doug >> >> > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From jwcolby at colbyconsulting.com Sun May 15 20:36:53 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sun, 15 May 2011 21:36:53 -0400 Subject: [dba-SQLServer] Problem Finding Database Engine In-Reply-To: References: Message-ID: <4DD07FB5.6020204@colbyconsulting.com> > You need to use the management console. In Windows 7, Control Panel then System and Security then Administrative Tools then Computer Management then Services and Applications then Services. Is that buried deep enough for ya? ;) Drag it out into quick launch tool bar. John W. Colby www.ColbyConsulting.com On 5/15/2011 3:15 PM, Doug Steele wrote: > Hi Arthur: > > You need to use the management console. In Windows 7, Control Panel > then System and Security then Administrative Tools then Computer > Management then Services and Applications then Services. In the list > of services look for 'SQL Server'. The Status should be 'Started' and > the Startup Type should be Automatic. If the Status isn't 'Started' > then you can start it by right clicking on the name and selecting > 'Start'. > > If the Startup Type is Automatic and it won't start when you boot the > computer, you have to look at the system logs to find out why it's > failing. I'll send more info if you need it. > > Doug > > On Sun, May 15, 2011 at 10:32 AM, Arthur Fuller wrote: >> I don't see an item in the service tray indicating that. Also, I can't >> remember how to invoke the engine manager itself (been on other projects >> lately and haven't been using SQL lately). Or perhaps it's a KPI of >> Alzheimers... >> >> Arthur >> >> On Sun, May 15, 2011 at 11:46 AM, Doug Steele wrote: >> >>> Is the SQL Server service actually running? I had a problem recently >>> where the service, despite being set as 'automatic', failed to load >>> properly when the computer started up. >>> >>> Doug >>> >>> >> _______________________________________________ >> dba-SQLServer mailing list >> dba-SQLServer at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >> http://www.databaseadvisors.com >> >> > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From mwp.reid at qub.ac.uk Mon May 16 02:36:47 2011 From: mwp.reid at qub.ac.uk (Martin Reid) Date: Mon, 16 May 2011 08:36:47 +0100 Subject: [dba-SQLServer] Problem Finding Database Engine In-Reply-To: <4DD07FB5.6020204@colbyconsulting.com> References: <4DD07FB5.6020204@colbyconsulting.com> Message-ID: <631CF83223105545BF43EFB52CB082954924AB7D10@EX2K7-VIRT-2.ads.qub.ac.uk> Am I missing something here Start->All Programs->SQL Server 2008 R2->SQL Server Configuration Manager Martin From fuller.artful at gmail.com Mon May 16 06:13:42 2011 From: fuller.artful at gmail.com (Arthur Fuller) Date: Mon, 16 May 2011 07:13:42 -0400 Subject: [dba-SQLServer] Problem Finding Database Engine In-Reply-To: <002f01cc1335$e36fef60$aa4fce20$@comcast.net> References: <002f01cc1335$e36fef60$aa4fce20$@comcast.net> Message-ID: Thanks Doug and Dan. All seems to be working now. Arthur On Sun, May 15, 2011 at 3:25 PM, Dan Waters wrote: > Hi Arthur, > > I've always connected via TCP/IP. IIRC, Management Studio is a remote > connection to SQL Server, even on the same PC. Because only TCP/IP handles > remote requests, that's what must be used to be able to connect with > Management Studio (and probably Visual Studio as well). > > Under administrative, go to the Computer Management control panel. At the > bottom open up Services and Applications. Then you'll see SQL Server > Configuration Manager. > > Now you'll see SQL Server Network Configuration - open that and then open > Protocols for SQL Server. You'll see the list of protocols - enable TCP/IP > and disable the others. > > You may also see SQL Native Client 10.0 Configuration. Open that and then > open Client Protocols. Again you'll see the list of protocols - enable > TCP/IP and disable the others. > > > Hope that works! > Dan > > -----Original Message----- > From: dba-sqlserver-bounces at databaseadvisors.com > [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Arthur > Fuller > Sent: Sunday, May 15, 2011 10:38 AM > To: Discussion concerning MS SQL Server > Subject: [dba-SQLServer] Problem Finding Database Engine > > Lately I've been rebuilding my main box. It's running Windows 7 Ultimate > 64-bit, and SQL 2008 Enterprise 64-bit.The SQL installation seemed to go > perfectly, but when I try to run Management Studio I am unable to connect. > I > get a message saying "a network or instance-specific error occurred while > establishing a connection to SQL Server. The server was not found or was > not > accessible. Verify that the instance name is correct and that SQL Server is > configured to allow remove connections. (provider:Named Pipes Provider, > error: 40 - Could not open a connection to SQL Server, error: 2). > This was from trying to connect to Database Engine. However I am able to > connect to Analysis Services (which happens to contain no databases at the > moment, but at least I can connect). > > Any idea what might be wrong and how I can fix it? > > TIA, > Arthur > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From dbdoug at gmail.com Mon May 16 08:20:29 2011 From: dbdoug at gmail.com (Doug Steele) Date: Mon, 16 May 2011 06:20:29 -0700 Subject: [dba-SQLServer] Problem Finding Database Engine In-Reply-To: <631CF83223105545BF43EFB52CB082954924AB7D10@EX2K7-VIRT-2.ads.qub.ac.uk> References: <4DD07FB5.6020204@colbyconsulting.com> <631CF83223105545BF43EFB52CB082954924AB7D10@EX2K7-VIRT-2.ads.qub.ac.uk> Message-ID: Hi Martin: You're right - you can also get to the service through the SQL Configuration Manager. I happen to use the Windows Management Console from time to time, so that's the way I find it myself. Thanks, Doug On Mon, May 16, 2011 at 12:36 AM, Martin Reid wrote: > Am I missing something here > > Start->All Programs->SQL Server 2008 R2->SQL Server Configuration Manager > > Martin > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From jwcolby at colbyconsulting.com Fri May 20 12:02:12 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Fri, 20 May 2011 13:02:12 -0400 Subject: [dba-SQLServer] Views don't sort Message-ID: <4DD69E94.5000100@colbyconsulting.com> One of the things I am trying to do is use SQL Server to speed up my applications. The theory is that I can hand off the heavy lifting to SQL Server and just get back result sets. Of course this works in terms of joins and filters in a view, but even though I specify a sort in a view, when the result set hits the other end (Access in my case) it is unsorted. Views have the ability to do sorts, so why is the data returned by a view into a third party app, or even into another view in SQL Server unsorted? Is there a way to tell sql server to return sorted data? -- John W. Colby www.ColbyConsulting.com From fhtapia at gmail.com Fri May 20 12:07:03 2011 From: fhtapia at gmail.com (Francisco Tapia) Date: Fri, 20 May 2011 10:07:03 -0700 Subject: [dba-SQLServer] Views don't sort In-Reply-To: <4DD69E94.5000100@colbyconsulting.com> References: <4DD69E94.5000100@colbyconsulting.com> Message-ID: So something like: Create View vwSomeView AS Select TOP 99.9999 percent Field1, Field2, Field3 >From tblSomeTable Order by Field3 does not sort field3? what are your results when you just select * from vwSomeView ? are the results sorted in your results display in management studio? -Francisco On Fri, May 20, 2011 at 10:02 AM, jwcolby wrote: > One of the things I am trying to do is use SQL Server to speed up my > applications. The theory is that I can hand off the heavy lifting to SQL > Server and just get back result sets. Of course this works in terms of > joins and filters in a view, but even though I specify a sort in a view, > when the result set hits the other end (Access in my case) it is unsorted. > > Views have the ability to do sorts, so why is the data returned by a view > into a third party app, or even into another view in SQL Server unsorted? > Is there a way to tell sql server to return sorted data? > > > From jwcolby at colbyconsulting.com Fri May 20 12:26:15 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Fri, 20 May 2011 13:26:15 -0400 Subject: [dba-SQLServer] Views don't sort In-Reply-To: References: <4DD69E94.5000100@colbyconsulting.com> Message-ID: <4DD6A437.6000904@colbyconsulting.com> Francisco, The sql from the view. SELECT TOP (100) PERCENT INM_ID, INM_LName + ', ' + INM_FName AS Name FROM dbo.tblInmate WHERE (INM_Active <> 0) ORDER BY Name This specific view is sorting ascending on the name field (calculated obviously). It does return sorted if I open it in design view and then bang the query. 32 BROWN, ANTHONY 35 CHISGAR, DENNIS 29 COCHRAN, ROBERT 33 COLLINS, WILLIE 36 EDMISTEN, FRED 37 EDWARDS, CASEY 6 ERVIN, DAVID but if I open a query and do select * from QryXYZ INM_ID Name 4 HUSH, KEITH 5 HODSDEN, MARK 6 ERVIN, DAVID 10 PRATT, BAXTER 11 POWELL, BOBBY 15 TURNER, CHARLES 17 HARDISON, DAVID 19 JONES, JEFFREY It appears that the query is getting the data sorted by the PKID (which has a clustered index on it). Back in access I get the same "ordered by PKID" order. John W. Colby www.ColbyConsulting.com On 5/20/2011 1:07 PM, Francisco Tapia wrote: > So something like: > > Create View vwSomeView AS > Select TOP 99.9999 percent Field1, Field2, Field3 >> From tblSomeTable > Order by Field3 > > does not sort field3? what are your results when you just select * from > vwSomeView ? are the results sorted in your results display in management > studio? > > > -Francisco > > > > > On Fri, May 20, 2011 at 10:02 AM, jwcolbywrote: > >> One of the things I am trying to do is use SQL Server to speed up my >> applications. The theory is that I can hand off the heavy lifting to SQL >> Server and just get back result sets. Of course this works in terms of >> joins and filters in a view, but even though I specify a sort in a view, >> when the result set hits the other end (Access in my case) it is unsorted. >> >> Views have the ability to do sorts, so why is the data returned by a view >> into a third party app, or even into another view in SQL Server unsorted? >> Is there a way to tell sql server to return sorted data? >> >> >> > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From jwcolby at colbyconsulting.com Fri May 20 12:31:42 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Fri, 20 May 2011 13:31:42 -0400 Subject: [dba-SQLServer] Views don't sort In-Reply-To: References: <4DD69E94.5000100@colbyconsulting.com> Message-ID: <4DD6A57E.7070309@colbyconsulting.com> Francisco, I apparently ignored your top 99.999% part. When I went back in to my view and selected top 1 million (very big) it did in fact return a sorted data set. Thanks! John W. Colby www.ColbyConsulting.com On 5/20/2011 1:07 PM, Francisco Tapia wrote: > So something like: > > Create View vwSomeView AS > Select TOP 99.9999 percent Field1, Field2, Field3 >> From tblSomeTable > Order by Field3 > > does not sort field3? what are your results when you just select * from > vwSomeView ? are the results sorted in your results display in management > studio? > > > -Francisco > > > > > On Fri, May 20, 2011 at 10:02 AM, jwcolbywrote: > >> One of the things I am trying to do is use SQL Server to speed up my >> applications. The theory is that I can hand off the heavy lifting to SQL >> Server and just get back result sets. Of course this works in terms of >> joins and filters in a view, but even though I specify a sort in a view, >> when the result set hits the other end (Access in my case) it is unsorted. >> >> Views have the ability to do sorts, so why is the data returned by a view >> into a third party app, or even into another view in SQL Server unsorted? >> Is there a way to tell sql server to return sorted data? >> >> >> > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From stuart at lexacorp.com.pg Fri May 20 15:47:35 2011 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Sat, 21 May 2011 06:47:35 +1000 Subject: [dba-SQLServer] Views don't sort In-Reply-To: <4DD6A57E.7070309@colbyconsulting.com> References: <4DD69E94.5000100@colbyconsulting.com>, , <4DD6A57E.7070309@colbyconsulting.com> Message-ID: <4DD6D367.19607.1B6A2E6F@stuart.lexacorp.com.pg> Be careful with that. It is not guaranteed to work! See http://msdn.microsoft.com/en-us/library/ms188385.aspx The ORDER BY clause is not valid in views, inline functions, derived tables, and subqueries, unless TOP is also specified. ... When ORDER BY is used in the definition of a view, inline function, derived table, or subquery, the clause is used only to determine the rows returned by the TOP clause. The ORDER BY clause does not guarantee ordered results when these constructs are queried, unless ORDER BY is also specified in the query itself The only way to be sure is to use "Select * from vwMyView Order by colMyCol" -- Stuart On 20 May 2011 at 13:31, jwcolby wrote: > Francisco, > > I apparently ignored your top 99.999% part. > > When I went back in to my view and selected top 1 million (very big) > it did in fact return a sorted data set. > > Thanks! > > John W. Colby > www.ColbyConsulting.com > > On 5/20/2011 1:07 PM, Francisco Tapia wrote: > > So something like: > > > > Create View vwSomeView AS > > Select TOP 99.9999 percent Field1, Field2, Field3 > >> From tblSomeTable > > Order by Field3 > > > > does not sort field3? what are your results when you just select * > > from vwSomeView ? are the results sorted in your results display in > > management studio? > > > > > > -Francisco > > > > > > > > > > On Fri, May 20, 2011 at 10:02 AM, > > jwcolbywrote: > > > >> One of the things I am trying to do is use SQL Server to speed up > >> my applications. The theory is that I can hand off the heavy > >> lifting to SQL Server and just get back result sets. Of course > >> this works in terms of joins and filters in a view, but even though > >> I specify a sort in a view, when the result set hits the other end > >> (Access in my case) it is unsorted. > >> > >> Views have the ability to do sorts, so why is the data returned by > >> a view into a third party app, or even into another view in SQL > >> Server unsorted? > >> Is there a way to tell sql server to return sorted data? > >> > >> > >> > > _______________________________________________ > > dba-SQLServer mailing list > > dba-SQLServer at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > http://www.databaseadvisors.com > > > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From fhtapia at gmail.com Fri May 20 16:43:25 2011 From: fhtapia at gmail.com (Francisco Tapia) Date: Fri, 20 May 2011 14:43:25 -0700 Subject: [dba-SQLServer] Views don't sort In-Reply-To: <4DD6A437.6000904@colbyconsulting.com> References: <4DD69E94.5000100@colbyconsulting.com> <4DD6A437.6000904@colbyconsulting.com> Message-ID: John, Please review my notation, of TOP 99.99999 percent (I think you can go out 9 digits after the decimal, there is a bug that for some reason did not get addressed until after sql server 2008 came out, and now you need to apply hotfixes to get it to work right (or just switch from top 100 percent to top 99.99999 percent http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b926292&sd=rss&spid=2855 add that to your view and you should see the results get re-organize appropriately w/o having to apply the hotfix. i know that for a while ms was taking the position that the order by clause in a view was non-ansi92 standards compliant, but then... how much of their tsql is? :) all vendors make concessions, but I think they had some bug within the engine during the optimization process. in Access if you create the link to your view as a LINKED query you can optionally also choose the query to be as Select * from viewMyView Order by MyCriteria = criteria and that will also provide all the heavy lifting on the sql engine side. hth... -Francisco http://bit.ly/sqlthis | Tsql and More... http://db.tt/JeXURAx | Drop Box, Storage in the Cloud (free) On Fri, May 20, 2011 at 10:26 AM, jwcolby wrote: > Francisco, > > The sql from the view. > > SELECT TOP (100) PERCENT INM_ID, INM_LName + ', ' + INM_FName AS Name > FROM dbo.tblInmate > WHERE (INM_Active <> 0) > ORDER BY Name > > This specific view is sorting ascending on the name field (calculated > obviously). > > It does return sorted if I open it in design view and then bang the query. > > 32 BROWN, ANTHONY > 35 CHISGAR, DENNIS > 29 COCHRAN, ROBERT > 33 COLLINS, WILLIE > 36 EDMISTEN, FRED > 37 EDWARDS, CASEY > 6 ERVIN, DAVID > > but if I open a query and do select * from QryXYZ > > INM_ID Name > 4 HUSH, KEITH > 5 HODSDEN, MARK > 6 ERVIN, DAVID > 10 PRATT, BAXTER > 11 POWELL, BOBBY > 15 TURNER, CHARLES > 17 HARDISON, DAVID > 19 JONES, JEFFREY > > It appears that the query is getting the data sorted by the PKID (which has > a clustered index on it). Back in access I get the same "ordered by PKID" > order. > > > John W. Colby > www.ColbyConsulting.com > > On 5/20/2011 1:07 PM, Francisco Tapia wrote: > >> So something like: >> >> Create View vwSomeView AS >> Select TOP 99.9999 percent Field1, Field2, Field3 >> >>> From tblSomeTable >>> >> Order by Field3 >> >> does not sort field3? what are your results when you just select * from >> vwSomeView ? are the results sorted in your results display in management >> studio? >> >> >> -Francisco >> >> >> >> >> >> On Fri, May 20, 2011 at 10:02 AM, jwcolby> >wrote: >> >> One of the things I am trying to do is use SQL Server to speed up my >>> applications. The theory is that I can hand off the heavy lifting to SQL >>> Server and just get back result sets. Of course this works in terms of >>> joins and filters in a view, but even though I specify a sort in a view, >>> when the result set hits the other end (Access in my case) it is >>> unsorted. >>> >>> Views have the ability to do sorts, so why is the data returned by a view >>> into a third party app, or even into another view in SQL Server unsorted? >>> Is there a way to tell sql server to return sorted data? >>> >>> >>> >>> _______________________________________________ >> dba-SQLServer mailing list >> dba-SQLServer at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >> http://www.databaseadvisors.com >> >> >> _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From ab-mi at post3.tele.dk Fri May 20 17:09:01 2011 From: ab-mi at post3.tele.dk (Asger Blond) Date: Sat, 21 May 2011 00:09:01 +0200 Subject: [dba-SQLServer] Views don't sort In-Reply-To: <4DD6D367.19607.1B6A2E6F@stuart.lexacorp.com.pg> References: <4DD69E94.5000100@colbyconsulting.com>, , <4DD6A57E.7070309@colbyconsulting.com> <4DD6D367.19607.1B6A2E6F@stuart.lexacorp.com.pg> Message-ID: Well, and this quote from BOL just doesn't make any sense to me. The TOP and ORDER BY clause is used to "determine the rows returned", but it "does not guarantee ordered results" - WTF does this mean? I use the construct specified by Francisco, and have never seen problems. Asger -----Oprindelig meddelelse----- Fra: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] P? vegne af Stuart McLachlan Sendt: 20. maj 2011 22:48 Til: Discussion concerning MS SQL Server Emne: Re: [dba-SQLServer] Views don't sort Be careful with that. It is not guaranteed to work! See http://msdn.microsoft.com/en-us/library/ms188385.aspx The ORDER BY clause is not valid in views, inline functions, derived tables, and subqueries, unless TOP is also specified. ... When ORDER BY is used in the definition of a view, inline function, derived table, or subquery, the clause is used only to determine the rows returned by the TOP clause. The ORDER BY clause does not guarantee ordered results when these constructs are queried, unless ORDER BY is also specified in the query itself The only way to be sure is to use "Select * from vwMyView Order by colMyCol" -- Stuart On 20 May 2011 at 13:31, jwcolby wrote: > Francisco, > > I apparently ignored your top 99.999% part. > > When I went back in to my view and selected top 1 million (very big) > it did in fact return a sorted data set. > > Thanks! > > John W. Colby > www.ColbyConsulting.com > > On 5/20/2011 1:07 PM, Francisco Tapia wrote: > > So something like: > > > > Create View vwSomeView AS > > Select TOP 99.9999 percent Field1, Field2, Field3 > >> From tblSomeTable > > Order by Field3 > > > > does not sort field3? what are your results when you just select * > > from vwSomeView ? are the results sorted in your results display in > > management studio? > > > > > > -Francisco > > > > > > > > > > On Fri, May 20, 2011 at 10:02 AM, > > jwcolbywrote: > > > >> One of the things I am trying to do is use SQL Server to speed up > >> my applications. The theory is that I can hand off the heavy > >> lifting to SQL Server and just get back result sets. Of course > >> this works in terms of joins and filters in a view, but even though > >> I specify a sort in a view, when the result set hits the other end > >> (Access in my case) it is unsorted. > >> > >> Views have the ability to do sorts, so why is the data returned by > >> a view into a third party app, or even into another view in SQL > >> Server unsorted? > >> Is there a way to tell sql server to return sorted data? > >> > >> > >> > > _______________________________________________ > > dba-SQLServer mailing list > > dba-SQLServer at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > http://www.databaseadvisors.com > > > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri May 20 18:00:39 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Fri, 20 May 2011 19:00:39 -0400 Subject: [dba-SQLServer] Views don't sort In-Reply-To: <4DD6D367.19607.1B6A2E6F@stuart.lexacorp.com.pg> References: <4DD69E94.5000100@colbyconsulting.com>, , <4DD6A57E.7070309@colbyconsulting.com> <4DD6D367.19607.1B6A2E6F@stuart.lexacorp.com.pg> Message-ID: <4DD6F297.3030603@colbyconsulting.com> I understand that. Unfortunately to do it "the safe way" means that it has to be done by the Jet engine on the workstation. That means back to all of the index pulls etc. John W. Colby www.ColbyConsulting.com On 5/20/2011 4:47 PM, Stuart McLachlan wrote: > Be careful with that. It is not guaranteed to work! > > See http://msdn.microsoft.com/en-us/library/ms188385.aspx > > The ORDER BY clause is not valid in views, inline functions, derived tables, and subqueries, > unless TOP is also specified. > ... > When ORDER BY is used in the definition of a view, inline function, derived table, or > subquery, the clause is used only to determine the rows returned by the TOP clause. The > ORDER BY clause does not guarantee ordered results when these constructs are queried, > unless ORDER BY is also specified in the query itself > > > The only way to be sure is to use "Select * from vwMyView Order by colMyCol" > From davidmcafee at gmail.com Fri May 20 18:10:37 2011 From: davidmcafee at gmail.com (David McAfee) Date: Fri, 20 May 2011 16:10:37 -0700 Subject: [dba-SQLServer] Views don't sort In-Reply-To: <4DD6F297.3030603@colbyconsulting.com> References: <4DD69E94.5000100@colbyconsulting.com> <4DD6A57E.7070309@colbyconsulting.com> <4DD6D367.19607.1B6A2E6F@stuart.lexacorp.com.pg> <4DD6F297.3030603@colbyconsulting.com> Message-ID: Can't you just call it from a SPROC and use a pass through query to call that? CREATE PROCEDURE stpSomeSproc AS SELECT * FROM vwMyView ORDER BY colMyCol On Fri, May 20, 2011 at 4:00 PM, jwcolby wrote: > I understand that. Unfortunately to do it "the safe way" means that it has > to be done by the Jet engine on the workstation. That means back to all of > the index pulls etc. > > > John W. Colby > www.ColbyConsulting.com > > On 5/20/2011 4:47 PM, Stuart McLachlan wrote: > >> Be careful with that. It is not guaranteed to work! >> >> See http://msdn.microsoft.com/en-us/library/ms188385.aspx >> >> The ORDER BY clause is not valid in views, inline functions, derived >> tables, and subqueries, >> unless TOP is also specified. >> ... >> When ORDER BY is used in the definition of a view, inline function, >> derived table, or >> subquery, the clause is used only to determine the rows returned by the >> TOP clause. The >> ORDER BY clause does not guarantee ordered results when these constructs >> are queried, >> unless ORDER BY is also specified in the query itself >> >> >> The only way to be sure is to use "Select * from vwMyView Order by >> colMyCol" >> >> _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From fhtapia at gmail.com Fri May 20 19:26:48 2011 From: fhtapia at gmail.com (Francisco Tapia) Date: Fri, 20 May 2011 17:26:48 -0700 Subject: [dba-SQLServer] Views don't sort In-Reply-To: <4DD6F297.3030603@colbyconsulting.com> References: <4DD69E94.5000100@colbyconsulting.com> <4DD6A57E.7070309@colbyconsulting.com> <4DD6D367.19607.1B6A2E6F@stuart.lexacorp.com.pg> <4DD6F297.3030603@colbyconsulting.com> Message-ID: <5594821079385653491@unknownmsgid> John, We've been using the top 99.99999 method in house and while we do test our sp patches, we have not had any issues with that, but to try to avoid an unholy war, it would be good for you to figure out how to implement passthrough queries from access, it's generally the better way to link to views and sprocs on a server. Calling a view/Sproc in a passthrough query is just like banging out the request in a SQL query window Ie, select * from viewMyView Or exec stp_myFavoriteSproc param1, param2 Sent from my mobile On May 20, 2011, at 4:01 PM, jwcolby wrote: > I understand that. Unfortunately to do it "the safe way" means that it has to be done by the Jet engine on the workstation. That means back to all of the index pulls etc. > > John W. Colby > www.ColbyConsulting.com > > On 5/20/2011 4:47 PM, Stuart McLachlan wrote: >> Be careful with that. It is not guaranteed to work! >> >> See http://msdn.microsoft.com/en-us/library/ms188385.aspx >> >> The ORDER BY clause is not valid in views, inline functions, derived tables, and subqueries, >> unless TOP is also specified. >> ... >> When ORDER BY is used in the definition of a view, inline function, derived table, or >> subquery, the clause is used only to determine the rows returned by the TOP clause. The >> ORDER BY clause does not guarantee ordered results when these constructs are queried, >> unless ORDER BY is also specified in the query itself >> >> >> The only way to be sure is to use "Select * from vwMyView Order by colMyCol" >> > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > From stuart at lexacorp.com.pg Fri May 20 23:28:38 2011 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Sat, 21 May 2011 14:28:38 +1000 Subject: [dba-SQLServer] Views don't sort In-Reply-To: References: <4DD69E94.5000100@colbyconsulting.com>, <4DD6D367.19607.1B6A2E6F@stuart.lexacorp.com.pg>, Message-ID: <4DD73F76.29589.1D104F40@stuart.lexacorp.com.pg> It means that if you specify "SELECT TOP 5 FROM ALPHABET ORDER BY LETTER", you will always get A,B,C,D and E, but they may not necessarily be in that order. They may be returned as "E,D,C,B,A", "D,B,A,E,C" etc. Although it has worked up til now, it is just like any other hack that uses "undocumented features". - after the next patch, hotfix or service pack, you may find that it no longer works that way - the same records could be returned in a completely different sort order, possibly by PK or by the order in which they are physically stored on disk. -- Stuart On 21 May 2011 at 0:09, Asger Blond wrote: > Well, and this quote from BOL just doesn't make any sense to me. The > TOP and ORDER BY clause is used to "determine the rows returned", but > it "does not guarantee ordered results" - WTF does this mean? I use > the construct specified by Francisco, and have never seen problems. > Asger > > -----Oprindelig meddelelse----- > Fra: dba-sqlserver-bounces at databaseadvisors.com > [mailto:dba-sqlserver-bounces at databaseadvisors.com] P? vegne af > Stuart McLachlan Sendt: 20. maj 2011 22:48 Til: Discussion concerning > MS SQL Server Emne: Re: [dba-SQLServer] Views don't sort > > Be careful with that. It is not guaranteed to work! > > See http://msdn.microsoft.com/en-us/library/ms188385.aspx > > The ORDER BY clause is not valid in views, inline functions, derived > tables, and subqueries, unless TOP is also specified. ... When ORDER > BY is used in the definition of a view, inline function, derived > table, or subquery, the clause is used only to determine the rows > returned by the TOP clause. The ORDER BY clause does not guarantee > ordered results when these constructs are queried, unless ORDER BY is > also specified in the query itself > > The only way to be sure is to use "Select * from vwMyView Order by > colMyCol" > > -- > Stuart > > On 20 May 2011 at 13:31, jwcolby wrote: > > > Francisco, > > > > I apparently ignored your top 99.999% part. > > > > When I went back in to my view and selected top 1 million (very big) > > it did in fact return a sorted data set. > > > > Thanks! > > > > John W. Colby > > www.ColbyConsulting.com > > > > On 5/20/2011 1:07 PM, Francisco Tapia wrote: > > > So something like: > > > > > > Create View vwSomeView AS > > > Select TOP 99.9999 percent Field1, Field2, Field3 > > >> From tblSomeTable > > > Order by Field3 > > > > > > does not sort field3? what are your results when you just select > > > * from vwSomeView ? are the results sorted in your results > > > display in management studio? > > > > > > > > > -Francisco > > > > > > > > > > > > > > > On Fri, May 20, 2011 at 10:02 AM, > > > jwcolbywrote: > > > > > >> One of the things I am trying to do is use SQL Server to speed up > > >> my applications. The theory is that I can hand off the heavy > > >> lifting to SQL Server and just get back result sets. Of course > > >> this works in terms of joins and filters in a view, but even > > >> though I specify a sort in a view, when the result set hits the > > >> other end (Access in my case) it is unsorted. > > >> > > >> Views have the ability to do sorts, so why is the data returned > > >> by a view into a third party app, or even into another view in > > >> SQL Server unsorted? > > >> Is there a way to tell sql server to return sorted data? > > >> > > >> > > >> > > > _______________________________________________ > > > dba-SQLServer mailing list > > > dba-SQLServer at databaseadvisors.com > > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > > http://www.databaseadvisors.com > > > > > > > > _______________________________________________ > > dba-SQLServer mailing list > > dba-SQLServer at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > http://www.databaseadvisors.com > > > > > > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > From ab-mi at post3.tele.dk Sat May 21 04:33:34 2011 From: ab-mi at post3.tele.dk (Asger Blond) Date: Sat, 21 May 2011 11:33:34 +0200 Subject: [dba-SQLServer] Views don't sort In-Reply-To: <4DD73F76.29589.1D104F40@stuart.lexacorp.com.pg> References: <4DD69E94.5000100@colbyconsulting.com>, <4DD6D367.19607.1B6A2E6F@stuart.lexacorp.com.pg>, <4DD73F76.29589.1D104F40@stuart.lexacorp.com.pg> Message-ID: Thanks for the explanation, Stuart. Still I've never seen the result you indicate. The TOP 100 PERCENT is a special case where the query engine will ignore the ordering specified since you are actually requesting all rows. But if you force the engine to make a selection using TOP 99.999999999 PERCENT then it makes no sense to me why the engine should not return the rows in the order it's being forced to use for the selection. And certainly if you use TOP 5 it would be quite inefficient for the engine not to return the ordered rows. So: when the engine is forced to use a condition (TOP 5 or TOP 99.999999999) I've never seen a situation where the rows are not returned in the order specified by the query - whether this is embedded in a view or just run as a plain query. Asger -----Oprindelig meddelelse----- Fra: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] P? vegne af Stuart McLachlan Sendt: 21. maj 2011 06:29 Til: Discussion concerning MS SQL Server Emne: Re: [dba-SQLServer] Views don't sort It means that if you specify "SELECT TOP 5 FROM ALPHABET ORDER BY LETTER", you will always get A,B,C,D and E, but they may not necessarily be in that order. They may be returned as "E,D,C,B,A", "D,B,A,E,C" etc. Although it has worked up til now, it is just like any other hack that uses "undocumented features". - after the next patch, hotfix or service pack, you may find that it no longer works that way - the same records could be returned in a completely different sort order, possibly by PK or by the order in which they are physically stored on disk. -- Stuart On 21 May 2011 at 0:09, Asger Blond wrote: > Well, and this quote from BOL just doesn't make any sense to me. The > TOP and ORDER BY clause is used to "determine the rows returned", but > it "does not guarantee ordered results" - WTF does this mean? I use > the construct specified by Francisco, and have never seen problems. > Asger > > -----Oprindelig meddelelse----- > Fra: dba-sqlserver-bounces at databaseadvisors.com > [mailto:dba-sqlserver-bounces at databaseadvisors.com] P? vegne af > Stuart McLachlan Sendt: 20. maj 2011 22:48 Til: Discussion concerning > MS SQL Server Emne: Re: [dba-SQLServer] Views don't sort > > Be careful with that. It is not guaranteed to work! > > See http://msdn.microsoft.com/en-us/library/ms188385.aspx > > The ORDER BY clause is not valid in views, inline functions, derived > tables, and subqueries, unless TOP is also specified. ... When ORDER > BY is used in the definition of a view, inline function, derived > table, or subquery, the clause is used only to determine the rows > returned by the TOP clause. The ORDER BY clause does not guarantee > ordered results when these constructs are queried, unless ORDER BY is > also specified in the query itself > > The only way to be sure is to use "Select * from vwMyView Order by > colMyCol" > > -- > Stuart > > On 20 May 2011 at 13:31, jwcolby wrote: > > > Francisco, > > > > I apparently ignored your top 99.999% part. > > > > When I went back in to my view and selected top 1 million (very big) > > it did in fact return a sorted data set. > > > > Thanks! > > > > John W. Colby > > www.ColbyConsulting.com > > > > On 5/20/2011 1:07 PM, Francisco Tapia wrote: > > > So something like: > > > > > > Create View vwSomeView AS > > > Select TOP 99.9999 percent Field1, Field2, Field3 > > >> From tblSomeTable > > > Order by Field3 > > > > > > does not sort field3? what are your results when you just select > > > * from vwSomeView ? are the results sorted in your results > > > display in management studio? > > > > > > > > > -Francisco > > > > > > > > > > > > > > > On Fri, May 20, 2011 at 10:02 AM, > > > jwcolbywrote: > > > > > >> One of the things I am trying to do is use SQL Server to speed up > > >> my applications. The theory is that I can hand off the heavy > > >> lifting to SQL Server and just get back result sets. Of course > > >> this works in terms of joins and filters in a view, but even > > >> though I specify a sort in a view, when the result set hits the > > >> other end (Access in my case) it is unsorted. > > >> > > >> Views have the ability to do sorts, so why is the data returned > > >> by a view into a third party app, or even into another view in > > >> SQL Server unsorted? > > >> Is there a way to tell sql server to return sorted data? > > >> > > >> > > >> > > > _______________________________________________ > > > dba-SQLServer mailing list > > > dba-SQLServer at databaseadvisors.com > > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > > http://www.databaseadvisors.com > > > > > > > > _______________________________________________ > > dba-SQLServer mailing list > > dba-SQLServer at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > http://www.databaseadvisors.com > > > > > > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From marklbreen at gmail.com Mon May 23 03:21:32 2011 From: marklbreen at gmail.com (Mark Breen) Date: Mon, 23 May 2011 09:21:32 +0100 Subject: [dba-SQLServer] Views don't sort In-Reply-To: References: <4DD69E94.5000100@colbyconsulting.com> <4DD6D367.19607.1B6A2E6F@stuart.lexacorp.com.pg> <4DD73F76.29589.1D104F40@stuart.lexacorp.com.pg> Message-ID: Hello All, I too have seen SQL Server / Access not return the sorted records. I am intrigued by Francisco's suggestion to try the 99.99...... options, but I am in the habit now of never ordering within a view and always ordering when i select data from a view. In the cases where I can use an sproc, then I do not use a view at all, just include the select that would go in the view in the sproc instead. Then I can safely sort in the sproc and no worries about the client end. John, may I tell you about a trick that I sometimes do, and please exclude me if you are already doing this. I create a Past Through query in Access, which as you know, ignores jet and sends the query straight to the source db (SQL Server in this case). I then programatically change the 'SQL' of the qdef based on what I want to do. Sometimes, I just call the pass-through query qpstTemplate. The template bit being the connection string. Sometimes I have two, qpstTemplate_ReturnsRecords and qpstTemplate_NoRecords. The 'returns no records' flag is set in the second one and I can use that for action sprocs. I then set the sql to be *usp_GetCustomers*, then later set it again to * usp_GetOrdersByOrderDate* As a result, I often do not need to sort within Access. As you instinctively know, asking Jet to do this work is not the right course. Do you want to let SQL server do the heavy lifting for you. Any help? thanks Mark On 21 May 2011 10:33, Asger Blond wrote: > Thanks for the explanation, Stuart. Still I've never seen the result you > indicate. The TOP 100 PERCENT is a special case where the query engine will > ignore the ordering specified since you are actually requesting all rows. > But if you force the engine to make a selection using TOP 99.999999999 > PERCENT then it makes no sense to me why the engine should not return the > rows in the order it's being forced to use for the selection. And certainly > if you use TOP 5 it would be quite inefficient for the engine not to return > the ordered rows. So: when the engine is forced to use a condition (TOP 5 or > TOP 99.999999999) I've never seen a situation where the rows are not > returned in the order specified by the query - whether this is embedded in a > view or just run as a plain query. > Asger > > -----Oprindelig meddelelse----- > Fra: dba-sqlserver-bounces at databaseadvisors.com [mailto: > dba-sqlserver-bounces at databaseadvisors.com] P? vegne af Stuart McLachlan > Sendt: 21. maj 2011 06:29 > Til: Discussion concerning MS SQL Server > Emne: Re: [dba-SQLServer] Views don't sort > > It means that if you specify "SELECT TOP 5 FROM ALPHABET ORDER BY LETTER", > you > will always get A,B,C,D and E, but they may not necessarily be in that > order. They may be > returned as "E,D,C,B,A", "D,B,A,E,C" etc. > > Although it has worked up til now, it is just like any other hack that uses > "undocumented > features". - after the next patch, hotfix or service pack, you may find > that it no longer works > that way - the same records could be returned in a completely different > sort order, possibly by > PK or by the order in which they are physically stored on disk. > > -- > Stuart > > On 21 May 2011 at 0:09, Asger Blond wrote: > > > Well, and this quote from BOL just doesn't make any sense to me. The > > TOP and ORDER BY clause is used to "determine the rows returned", but > > it "does not guarantee ordered results" - WTF does this mean? I use > > the construct specified by Francisco, and have never seen problems. > > Asger > > > > -----Oprindelig meddelelse----- > > Fra: dba-sqlserver-bounces at databaseadvisors.com > > [mailto:dba-sqlserver-bounces at databaseadvisors.com] P? vegne af > > Stuart McLachlan Sendt: 20. maj 2011 22:48 Til: Discussion concerning > > MS SQL Server Emne: Re: [dba-SQLServer] Views don't sort > > > > Be careful with that. It is not guaranteed to work! > > > > See http://msdn.microsoft.com/en-us/library/ms188385.aspx > > > > The ORDER BY clause is not valid in views, inline functions, derived > > tables, and subqueries, unless TOP is also specified. ... When ORDER > > BY is used in the definition of a view, inline function, derived > > table, or subquery, the clause is used only to determine the rows > > returned by the TOP clause. The ORDER BY clause does not guarantee > > ordered results when these constructs are queried, unless ORDER BY is > > also specified in the query itself > > > > The only way to be sure is to use "Select * from vwMyView Order by > > colMyCol" > > > > -- > > Stuart > > > > On 20 May 2011 at 13:31, jwcolby wrote: > > > > > Francisco, > > > > > > I apparently ignored your top 99.999% part. > > > > > > When I went back in to my view and selected top 1 million (very big) > > > it did in fact return a sorted data set. > > > > > > Thanks! > > > > > > John W. Colby > > > www.ColbyConsulting.com > > > > > > On 5/20/2011 1:07 PM, Francisco Tapia wrote: > > > > So something like: > > > > > > > > Create View vwSomeView AS > > > > Select TOP 99.9999 percent Field1, Field2, Field3 > > > >> From tblSomeTable > > > > Order by Field3 > > > > > > > > does not sort field3? what are your results when you just select > > > > * from vwSomeView ? are the results sorted in your results > > > > display in management studio? > > > > > > > > > > > > -Francisco > > > > > > > > > > > > > > > > > > > > On Fri, May 20, 2011 at 10:02 AM, > > > > jwcolbywrote: > > > > > > > >> One of the things I am trying to do is use SQL Server to speed up > > > >> my applications. The theory is that I can hand off the heavy > > > >> lifting to SQL Server and just get back result sets. Of course > > > >> this works in terms of joins and filters in a view, but even > > > >> though I specify a sort in a view, when the result set hits the > > > >> other end (Access in my case) it is unsorted. > > > >> > > > >> Views have the ability to do sorts, so why is the data returned > > > >> by a view into a third party app, or even into another view in > > > >> SQL Server unsorted? > > > >> Is there a way to tell sql server to return sorted data? > > > >> > > > >> > > > >> > > > > _______________________________________________ > > > > dba-SQLServer mailing list > > > > dba-SQLServer at databaseadvisors.com > > > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > > > http://www.databaseadvisors.com > > > > > > > > > > > _______________________________________________ > > > dba-SQLServer mailing list > > > dba-SQLServer at databaseadvisors.com > > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > > http://www.databaseadvisors.com > > > > > > > > > > > > > > _______________________________________________ > > dba-SQLServer mailing list > > dba-SQLServer at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > http://www.databaseadvisors.com > > > > > > _______________________________________________ > > dba-SQLServer mailing list > > dba-SQLServer at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > http://www.databaseadvisors.com > > > > > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From jwcolby at colbyconsulting.com Mon May 23 05:41:57 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Mon, 23 May 2011 06:41:57 -0400 Subject: [dba-SQLServer] Views don't sort In-Reply-To: References: <4DD69E94.5000100@colbyconsulting.com> <4DD6D367.19607.1B6A2E6F@stuart.lexacorp.com.pg> <4DD73F76.29589.1D104F40@stuart.lexacorp.com.pg> Message-ID: <4DDA39F5.5070408@colbyconsulting.com> Mark, AFAICT pass through queries are not editable. I am trying to build three specific types of queries. 1) Editable (bound) form queries 2) Uneditable combo queries 3) Uneditable report queries. I am using Access 2K3 for dev and Access 2K7 (runtime) someday soon to be 2K10 (runtime) for general usage. It seems that the top(very large number) works for the moment for returning sorted recordsets. OTOH doing the pass-through trick for doing filtered uneditable queries would work great. John W. Colby www.ColbyConsulting.com On 5/23/2011 4:21 AM, Mark Breen wrote: > Hello All, > > I too have seen SQL Server / Access not return the sorted records. I am > intrigued by Francisco's suggestion to try the 99.99...... options, but I am > in the habit now of never ordering within a view and always ordering when i > select data from a view. > > In the cases where I can use an sproc, then I do not use a view at all, just > include the select that would go in the view in the sproc instead. Then I > can safely sort in the sproc and no worries about the client end. > > John, may I tell you about a trick that I sometimes do, and please exclude > me if you are already doing this. I create a Past Through query in Access, > which as you know, ignores jet and sends the query straight to the source db > (SQL Server in this case). I then programatically change the 'SQL' of the > qdef based on what I want to do. Sometimes, I just call the pass-through > query qpstTemplate. The template bit being the connection string. > > Sometimes I have two, qpstTemplate_ReturnsRecords and > qpstTemplate_NoRecords. The 'returns no records' flag is set in the second > one and I can use that for action sprocs. > > I then set the sql to be *usp_GetCustomers*, then later set it again to * > usp_GetOrdersByOrderDate* > > As a result, I often do not need to sort within Access. As you > instinctively know, asking Jet to do this work is not the right course. Do > you want to let SQL server do the heavy lifting for you. > > Any help? > > thanks > > Mark > > > > On 21 May 2011 10:33, Asger Blond wrote: > >> Thanks for the explanation, Stuart. Still I've never seen the result you >> indicate. The TOP 100 PERCENT is a special case where the query engine will >> ignore the ordering specified since you are actually requesting all rows. >> But if you force the engine to make a selection using TOP 99.999999999 >> PERCENT then it makes no sense to me why the engine should not return the >> rows in the order it's being forced to use for the selection. And certainly >> if you use TOP 5 it would be quite inefficient for the engine not to return >> the ordered rows. So: when the engine is forced to use a condition (TOP 5 or >> TOP 99.999999999) I've never seen a situation where the rows are not >> returned in the order specified by the query - whether this is embedded in a >> view or just run as a plain query. >> Asger >> >> -----Oprindelig meddelelse----- >> Fra: dba-sqlserver-bounces at databaseadvisors.com [mailto: >> dba-sqlserver-bounces at databaseadvisors.com] P? vegne af Stuart McLachlan >> Sendt: 21. maj 2011 06:29 >> Til: Discussion concerning MS SQL Server >> Emne: Re: [dba-SQLServer] Views don't sort >> >> It means that if you specify "SELECT TOP 5 FROM ALPHABET ORDER BY LETTER", >> you >> will always get A,B,C,D and E, but they may not necessarily be in that >> order. They may be >> returned as "E,D,C,B,A", "D,B,A,E,C" etc. >> >> Although it has worked up til now, it is just like any other hack that uses >> "undocumented >> features". - after the next patch, hotfix or service pack, you may find >> that it no longer works >> that way - the same records could be returned in a completely different >> sort order, possibly by >> PK or by the order in which they are physically stored on disk. >> >> -- >> Stuart >> >> On 21 May 2011 at 0:09, Asger Blond wrote: >> >>> Well, and this quote from BOL just doesn't make any sense to me. The >>> TOP and ORDER BY clause is used to "determine the rows returned", but >>> it "does not guarantee ordered results" - WTF does this mean? I use >>> the construct specified by Francisco, and have never seen problems. >>> Asger >>> >>> -----Oprindelig meddelelse----- >>> Fra: dba-sqlserver-bounces at databaseadvisors.com >>> [mailto:dba-sqlserver-bounces at databaseadvisors.com] P? vegne af >>> Stuart McLachlan Sendt: 20. maj 2011 22:48 Til: Discussion concerning >>> MS SQL Server Emne: Re: [dba-SQLServer] Views don't sort >>> >>> Be careful with that. It is not guaranteed to work! >>> >>> See http://msdn.microsoft.com/en-us/library/ms188385.aspx >>> >>> The ORDER BY clause is not valid in views, inline functions, derived >>> tables, and subqueries, unless TOP is also specified. ... When ORDER >>> BY is used in the definition of a view, inline function, derived >>> table, or subquery, the clause is used only to determine the rows >>> returned by the TOP clause. The ORDER BY clause does not guarantee >>> ordered results when these constructs are queried, unless ORDER BY is >>> also specified in the query itself >>> >>> The only way to be sure is to use "Select * from vwMyView Order by >>> colMyCol" >>> >>> -- >>> Stuart >>> >>> On 20 May 2011 at 13:31, jwcolby wrote: >>> >>>> Francisco, >>>> >>>> I apparently ignored your top 99.999% part. >>>> >>>> When I went back in to my view and selected top 1 million (very big) >>>> it did in fact return a sorted data set. >>>> >>>> Thanks! >>>> >>>> John W. Colby >>>> www.ColbyConsulting.com >>>> >>>> On 5/20/2011 1:07 PM, Francisco Tapia wrote: >>>>> So something like: >>>>> >>>>> Create View vwSomeView AS >>>>> Select TOP 99.9999 percent Field1, Field2, Field3 >>>>>> From tblSomeTable >>>>> Order by Field3 >>>>> >>>>> does not sort field3? what are your results when you just select >>>>> * from vwSomeView ? are the results sorted in your results >>>>> display in management studio? >>>>> >>>>> >>>>> -Francisco >>>>> >>>>> >>>>> >>>>> >>>>> On Fri, May 20, 2011 at 10:02 AM, >>>>> jwcolbywrote: >>>>> >>>>>> One of the things I am trying to do is use SQL Server to speed up >>>>>> my applications. The theory is that I can hand off the heavy >>>>>> lifting to SQL Server and just get back result sets. Of course >>>>>> this works in terms of joins and filters in a view, but even >>>>>> though I specify a sort in a view, when the result set hits the >>>>>> other end (Access in my case) it is unsorted. >>>>>> >>>>>> Views have the ability to do sorts, so why is the data returned >>>>>> by a view into a third party app, or even into another view in >>>>>> SQL Server unsorted? >>>>>> Is there a way to tell sql server to return sorted data? >>>>>> >>>>>> >>>>>> >>>>> _______________________________________________ >>>>> dba-SQLServer mailing list >>>>> dba-SQLServer at databaseadvisors.com >>>>> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >>>>> http://www.databaseadvisors.com >>>>> >>>>> >>>> _______________________________________________ >>>> dba-SQLServer mailing list >>>> dba-SQLServer at databaseadvisors.com >>>> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >>>> http://www.databaseadvisors.com >>>> >>>> >>> >>> >>> >>> _______________________________________________ >>> dba-SQLServer mailing list >>> dba-SQLServer at databaseadvisors.com >>> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >>> http://www.databaseadvisors.com >>> >>> >>> _______________________________________________ >>> dba-SQLServer mailing list >>> dba-SQLServer at databaseadvisors.com >>> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >>> http://www.databaseadvisors.com >>> >> >> >> >> >> _______________________________________________ >> dba-SQLServer mailing list >> dba-SQLServer at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >> http://www.databaseadvisors.com >> >> >> _______________________________________________ >> dba-SQLServer mailing list >> dba-SQLServer at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >> http://www.databaseadvisors.com >> >> > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From fuller.artful at gmail.com Mon May 23 13:25:40 2011 From: fuller.artful at gmail.com (Arthur Fuller) Date: Mon, 23 May 2011 14:25:40 -0400 Subject: [dba-SQLServer] Attach a database without its log file Message-ID: Is it possible to attach a database without its log file? It occurred to me that I could create an empty database, then copy its log file to a new name, then attach the database, but I haven't tried it yet. TIA, Arthur From jwcolby at colbyconsulting.com Mon May 23 13:55:19 2011 From: jwcolby at colbyconsulting.com (jwcolby) Date: Mon, 23 May 2011 14:55:19 -0400 Subject: [dba-SQLServer] Attach a database without its log file In-Reply-To: References: Message-ID: <4DDAAD97.1000104@colbyconsulting.com> yep, it creates a new one. John W. Colby www.ColbyConsulting.com On 5/23/2011 2:25 PM, Arthur Fuller wrote: > Is it possible to attach a database without its log file? It occurred to me > that I could create an empty database, then copy its log file to a new name, > then attach the database, but I haven't tried it yet. > > TIA, > Arthur > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From marklbreen at gmail.com Tue May 24 05:29:36 2011 From: marklbreen at gmail.com (Mark Breen) Date: Tue, 24 May 2011 11:29:36 +0100 Subject: [dba-SQLServer] Attach a database without its log file In-Reply-To: <4DDAAD97.1000104@colbyconsulting.com> References: <4DDAAD97.1000104@colbyconsulting.com> Message-ID: Hello Arthur / John And it is a great way to truncate the huge log file. I use this trick all the time. just detach the db, then rename or delete the log file and then re-attach the db, and tell the GUI attach dialog to remove the 'missing' log file. Hey presto you have a nice small log file again Mark On 23 May 2011 19:55, jwcolby wrote: > yep, it creates a new one. > > John W. Colby > www.ColbyConsulting.com > > > On 5/23/2011 2:25 PM, Arthur Fuller wrote: > >> Is it possible to attach a database without its log file? It occurred to >> me >> that I could create an empty database, then copy its log file to a new >> name, >> then attach the database, but I haven't tried it yet. >> >> TIA, >> Arthur >> _______________________________________________ >> dba-SQLServer mailing list >> dba-SQLServer at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >> http://www.databaseadvisors.com >> >> >> _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From marklbreen at gmail.com Tue May 24 05:30:54 2011 From: marklbreen at gmail.com (Mark Breen) Date: Tue, 24 May 2011 11:30:54 +0100 Subject: [dba-SQLServer] Fwd: Views don't sort In-Reply-To: References: <4DD69E94.5000100@colbyconsulting.com> <4DD6D367.19607.1B6A2E6F@stuart.lexacorp.com.pg> <4DD73F76.29589.1D104F40@stuart.lexacorp.com.pg> <4DDA39F5.5070408@colbyconsulting.com> Message-ID: Hello John, Yes, if you want to update your data, you will either have to write update statements or jump through some other hoops such as 1) download the subset of records to Jet that you want to update 2) Bind your subset Jet table to a form and make you bound updates, setting a special column you name as "UpdatedInJet" 3) when all bound updates are complete call an sproc or raw SQL to update the records in the server that Jet bound forms allowed you to update. It sounds like a hack, but it may transpire you can code is all in 20 mins. IMO, you could make you use both strengths with a solution like this. IE, SQL does the heavy work and your bound forms in jet do the heavy coding. Any help? Mark Anyway, in case that it helps with the use case, here is a snippit of my code. As you can see, I use a previously created qpst to call any sproc (or any other sql for that matter), with any params I want or need to do. It means that for Selecting Data, I never ask Jet to do any heavy lifting. Sub S_Logging(strMsg As String) Dim qdef As QueryDef Set qdef = CurrentDb.QueryDefs("qpstLogging") qdef.SQL = "usp_MB_Logging '" & strMsg & "'" DoCmd.OpenQuery ("qpstLogging") End Sub On 23 May 2011 11:41, jwcolby wrote: > Mark, > > AFAICT pass through queries are not editable. I am trying to build three > specific types of queries. > > 1) Editable (bound) form queries > 2) Uneditable combo queries > 3) Uneditable report queries. > > I am using Access 2K3 for dev and Access 2K7 (runtime) someday soon to be > 2K10 (runtime) for general usage. > > It seems that the top(very large number) works for the moment for returning > sorted recordsets. OTOH doing the pass-through trick for doing filtered > uneditable queries would work great. > > > John W. Colby > www.ColbyConsulting.com > > From fuller.artful at gmail.com Tue May 24 05:45:49 2011 From: fuller.artful at gmail.com (Arthur Fuller) Date: Tue, 24 May 2011 06:45:49 -0400 Subject: [dba-SQLServer] Attach a database without its log file In-Reply-To: References: <4DDAAD97.1000104@colbyconsulting.com> Message-ID: Yup. It worked like a charm. All my old databases are now attached. A. On Tue, May 24, 2011 at 6:29 AM, Mark Breen wrote: > Hello Arthur / John > > And it is a great way to truncate the huge log file. I use this trick all > the time. > > just detach the db, then rename or delete the log file and then re-attach > the db, and tell the GUI attach dialog to remove the 'missing' log file. > Hey presto you have a nice small log file again > > Mark > > From fhtapia at gmail.com Tue May 24 09:46:28 2011 From: fhtapia at gmail.com (Francisco Tapia) Date: Tue, 24 May 2011 07:46:28 -0700 Subject: [dba-SQLServer] Attach a database without its log file In-Reply-To: References: <4DDAAD97.1000104@colbyconsulting.com> Message-ID: Mark, I completely understand that while developing you may only wish to carry around the db file, especially if you are delivering a new database design to a client. What I don't understand is why you would choose to use this method to mitigate log file size in a normal day-to-day scenario? I am having a hard time thinking about what would justify stopping my database to detach it, only to re-attach it just to create a small transaction log file? If while developing you don't want the log file to get out of control you would then configure in enterprise manager (sql server 2000) or management studio (sql server 2005+) your database to be setup with the "Simple" recovery option. This would then bypass storing any changes in the tlog before making it to the database and thus keeping your tlog small to begin with. If you are in a production environment and you ran some might big updates and now need to recover your database size, then why not just use the tools built within sql server? Ideally you would first run a full backup of the database, then backup the log with the truncate only flag, followed by the shrink file command as such: BACKUP LOG myFavoriteDB WITH TRUNCATE_ONLY DBCC SHRINKFILE ('myFavoriteDB_log', 10) Where 10 is the new size in MB of the transaction log. remember ideally in a production environment you'd want the transaction log to be about 10% size of the database file, however there are exceptions. just wondering... -Francisco On Tue, May 24, 2011 at 3:29 AM, Mark Breen wrote: > Hello Arthur / John > > And it is a great way to truncate the huge log file. I use this trick all > the time. > > just detach the db, then rename or delete the log file and then re-attach > the db, and tell the GUI attach dialog to remove the 'missing' log file. > Hey presto you have a nice small log file again > > Mark > > > On 23 May 2011 19:55, jwcolby wrote: > > > yep, it creates a new one. > > > > John W. Colby > > www.ColbyConsulting.com > > > > > > On 5/23/2011 2:25 PM, Arthur Fuller wrote: > > > >> Is it possible to attach a database without its log file? It occurred to > >> me > >> that I could create an empty database, then copy its log file to a new > >> name, > >> then attach the database, but I haven't tried it yet. > >> > >> TIA, > >> Arthur > >> _______________________________________________ > >> dba-SQLServer mailing list > >> dba-SQLServer at databaseadvisors.com > >> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > >> http://www.databaseadvisors.com > >> > >> > >> _______________________________________________ > > dba-SQLServer mailing list > > dba-SQLServer at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > http://www.databaseadvisors.com > > > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From marklbreen at gmail.com Wed May 25 03:30:58 2011 From: marklbreen at gmail.com (Mark Breen) Date: Wed, 25 May 2011 09:30:58 +0100 Subject: [dba-SQLServer] Attach a database without its log file In-Reply-To: References: <4DDAAD97.1000104@colbyconsulting.com> Message-ID: Hi Francisco, Thanks for your response. I have a scientific explanation and also ridiculously silly explanation, I will start with the ridiculous one first. *Ridiculous Explanation* After years of trying to shrink databases, and years of not fully understanding the way the log file works (may not still fully understand it), when I discovered how I could trash the log file, I think I subliminally feel I am taking revenge on all the large log files I had in the past. So this heavy handed approach allows me to show SQL Server transaction logs who is really boss. *More Realistic Explanation* Nowadays, the first thing I do with a db is to switch the recovery option to Simple. It is a solution to years of enormous log files. In the past 15 year however, before either a) I discovered simple recovery mode or b) maybe simple recovery was not in SQL 6.5 / 7.0 I struggled with large log files. As you say, with an important db, the first thing we want to do is to back it up, but with enormous log files, I often struggled to get the db to backup. In the case that the drive was already full, it was even worse. In SQL 7 days, if you recall, there was a special iterative script that we used to run to fill the log file pages to a sufficient extent that we could get it to properly reduce in size. To be honest, I do not use this method to make it easier to carry around db files, actually, to move a db, I always do a backup and restore - should I consider detach and attach ? Is it better? What are the main differences between detaching, copying and attaching vs backing up and copying and restoring ? The main situation I do it is when I have a big log file because I forget to switch to Simple Recovery. I just quickly mentally check I have recent backups - usually I do - and the trash the log file and continue working. As I was writing this, I googled With Truncate Only, and came across this http://sqlserverpedia.com/blog/sql-server-backup-and-restore/backup-log-with-truncate_only-like-a-bear-trap/ Here is the opening paragraph *It?s somewhat akin to asking, ?What?s the best way to cut my hand off to free myself from this bear trap before I starve to death in the wilderness?? Well, you shouldn?t be sticking your hand in bear traps to begin with, but if you find your hand in a bear trap, ANY way to get out of it is a good way. Pocket knife, teeth, band saw, whatever it takes.* Following this email, I intend to experiment with With Truncate Only, but may I ask, is there actually much difference between remove the actualy file and doing a truncate and then a shrink? I suppose the shrink with 10% ensures you save time re-building the file size up to 10%. In summary, after often struggling to shrink a log file, the simplicity of simply removing it and letting SQL Server manage the re-creation really appeals to me. Thanks Mark * * On 24 May 2011 15:46, Francisco Tapia wrote: > Mark, > I completely understand that while developing you may only wish to carry > around the db file, especially if you are delivering a new database design > to a client. What I don't understand is why you would choose to use this > method to mitigate log file size in a normal day-to-day scenario? I am > having a hard time thinking about what would justify stopping my database > to > detach it, only to re-attach it just to create a small transaction log > file? > > If while developing you don't want the log file to get out of control you > would then configure in enterprise manager (sql server 2000) or management > studio (sql server 2005+) your database to be setup with the "Simple" > recovery option. This would then bypass storing any changes in the tlog > before making it to the database and thus keeping your tlog small to begin > with. > > If you are in a production environment and you ran some might big updates > and now need to recover your database size, then why not just use the tools > built within sql server? Ideally you would first run a full backup of the > database, then backup the log with the truncate only flag, followed by the > shrink file command as such: > > BACKUP LOG myFavoriteDB WITH TRUNCATE_ONLY > DBCC SHRINKFILE ('myFavoriteDB_log', 10) > > Where 10 is the new size in MB of the transaction log. remember ideally in > a production environment you'd want the transaction log to be about 10% > size > of the database file, however there are exceptions. > > > just wondering... > -Francisco > > > On Tue, May 24, 2011 at 3:29 AM, Mark Breen wrote: > > > Hello Arthur / John > > > > And it is a great way to truncate the huge log file. I use this trick > all > > the time. > > > > just detach the db, then rename or delete the log file and then re-attach > > the db, and tell the GUI attach dialog to remove the 'missing' log file. > > Hey presto you have a nice small log file again > > > > Mark > > > > > > On 23 May 2011 19:55, jwcolby wrote: > > > > > yep, it creates a new one. > > > > > > John W. Colby > > > www.ColbyConsulting.com > > > > > > > > > On 5/23/2011 2:25 PM, Arthur Fuller wrote: > > > > > >> Is it possible to attach a database without its log file? It occurred > to > > >> me > > >> that I could create an empty database, then copy its log file to a new > > >> name, > > >> then attach the database, but I haven't tried it yet. > > >> > > >> TIA, > > >> Arthur > > >> _______________________________________________ > > >> dba-SQLServer mailing list > > >> dba-SQLServer at databaseadvisors.com > > >> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > >> http://www.databaseadvisors.com > > >> > > >> > > >> _______________________________________________ > > > dba-SQLServer mailing list > > > dba-SQLServer at databaseadvisors.com > > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > > http://www.databaseadvisors.com > > > > > > > > _______________________________________________ > > dba-SQLServer mailing list > > dba-SQLServer at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > http://www.databaseadvisors.com > > > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From Robert at WeBeDb.com Wed May 25 09:30:59 2011 From: Robert at WeBeDb.com (Robert) Date: Wed, 25 May 2011 09:30:59 -0500 Subject: [dba-SQLServer] Views don't sort In-Reply-To: References: Message-ID: <7CE49A34-194F-4B4D-B0E1-DA0F10ADCB6A@holly.arvixe.com> John, The minute you raid uneditable, you should be using a stored procedure and a pass through query. For editable, your choices are views with the PK included or the tables, the first being the preference. BTW...The non-sort behavior started with 2005. Robert At 05:31 AM 5/24/2011, you wrote: >From: jwcolby >To: Discussion concerning MS SQL Server > >Subject: Re: [dba-SQLServer] Views don't sort >Message-ID: <4DDA39F5.5070408 at colbyconsulting.com> >Content-Type: text/plain; charset=ISO-8859-1; format=flowed > >Mark, > >AFAICT pass through queries are not editable. I am trying to build >three specific types of queries. > >1) Editable (bound) form queries >2) Uneditable combo queries >3) Uneditable report queries. > >I am using Access 2K3 for dev and Access 2K7 (runtime) someday soon >to be 2K10 (runtime) for general >usage. > >It seems that the top(very large number) works for the moment for >returning sorted recordsets. OTOH >doing the pass-through trick for doing filtered uneditable queries >would work great. > >John W. Colby >www.ColbyConsulting.com From fuller.artful at gmail.com Sun May 15 10:10:48 2011 From: fuller.artful at gmail.com (Arthur Fuller) Date: Sun, 15 May 2011 15:10:48 -0000 Subject: [dba-SQLServer] Problems finding SQL Server Message-ID: Lately I've been rebuilding my main box. It's running Windows 7 Ultimate 64-bit, and SQL 2008 Enterprise 64-bit.The SQL installation seemed to go perfectly, but when I try to run Management Studio I am unable to connect. I get a message saying "a network or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remove connections. (provider:Named Pipes Provider, error: 40 - Could not open a connection to SQL Server, error: 2). This I can however open From fhtapia at gmail.com Tue May 24 09:51:06 2011 From: fhtapia at gmail.com (Francisco Tapia) Date: Tue, 24 May 2011 07:51:06 -0700 Subject: [dba-SQLServer] Views don't sort In-Reply-To: <4DDA39F5.5070408@colbyconsulting.com> References: <4DD69E94.5000100@colbyconsulting.com> <4DD6D367.19607.1B6A2E6F@stuart.lexacorp.com.pg> <4DD73F76.29589.1D104F40@stuart.lexacorp.com.pg> <4DDA39F5.5070408@colbyconsulting.com> Message-ID: John, Having worked between Access and Sql Server for a long time, I can tell you that what you are trying to do is many times do-able when your Access front end is an "Access Data Project" vs a normal Access Database. and the "bound" methods that you normally use are still available. Though, you will need to jump a whole new set of hoops just to make your bound forms work as you wanted. Let's not mistake this as a "bound vs unbound" unholy war, but I'm just saying. There may be a need for you to extend your framework to handle this situations so that you can leverage your "bound" project. -Francisco http://bit.ly/sqlthis | Tsql and More... http://db.tt/JeXURAx | Drop Box, Storage in the Cloud (free) On Mon, May 23, 2011 at 3:41 AM, jwcolby wrote: > Mark, > > AFAICT pass through queries are not editable. I am trying to build three > specific types of queries. > > 1) Editable (bound) form queries > 2) Uneditable combo queries > 3) Uneditable report queries. > > I am using Access 2K3 for dev and Access 2K7 (runtime) someday soon to be > 2K10 (runtime) for general usage. > > It seems that the top(very large number) works for the moment for returning > sorted recordsets. OTOH doing the pass-through trick for doing filtered > uneditable queries would work great. > > > John W. Colby > www.ColbyConsulting.com > > On 5/23/2011 4:21 AM, Mark Breen wrote: > >> Hello All, >> >> I too have seen SQL Server / Access not return the sorted records. I am >> intrigued by Francisco's suggestion to try the 99.99...... options, but I >> am >> in the habit now of never ordering within a view and always ordering when >> i >> select data from a view. >> >> In the cases where I can use an sproc, then I do not use a view at all, >> just >> include the select that would go in the view in the sproc instead. Then I >> can safely sort in the sproc and no worries about the client end. >> >> John, may I tell you about a trick that I sometimes do, and please exclude >> me if you are already doing this. I create a Past Through query in >> Access, >> which as you know, ignores jet and sends the query straight to the source >> db >> (SQL Server in this case). I then programatically change the 'SQL' of the >> qdef based on what I want to do. Sometimes, I just call the pass-through >> query qpstTemplate. The template bit being the connection string. >> >> Sometimes I have two, qpstTemplate_ReturnsRecords and >> qpstTemplate_NoRecords. The 'returns no records' flag is set in the >> second >> one and I can use that for action sprocs. >> >> I then set the sql to be *usp_GetCustomers*, then later set it again to * >> usp_GetOrdersByOrderDate* >> >> As a result, I often do not need to sort within Access. As you >> instinctively know, asking Jet to do this work is not the right course. >> Do >> you want to let SQL server do the heavy lifting for you. >> >> Any help? >> >> thanks >> >> Mark >> >> >> >> On 21 May 2011 10:33, Asger Blond wrote: >> >> Thanks for the explanation, Stuart. Still I've never seen the result you >>> indicate. The TOP 100 PERCENT is a special case where the query engine >>> will >>> ignore the ordering specified since you are actually requesting all rows. >>> But if you force the engine to make a selection using TOP 99.999999999 >>> PERCENT then it makes no sense to me why the engine should not return the >>> rows in the order it's being forced to use for the selection. And >>> certainly >>> if you use TOP 5 it would be quite inefficient for the engine not to >>> return >>> the ordered rows. So: when the engine is forced to use a condition (TOP 5 >>> or >>> TOP 99.999999999) I've never seen a situation where the rows are not >>> returned in the order specified by the query - whether this is embedded >>> in a >>> view or just run as a plain query. >>> Asger >>> >>> -----Oprindelig meddelelse----- >>> Fra: dba-sqlserver-bounces at databaseadvisors.com [mailto: >>> dba-sqlserver-bounces at databaseadvisors.com] P? vegne af Stuart McLachlan >>> Sendt: 21. maj 2011 06:29 >>> Til: Discussion concerning MS SQL Server >>> Emne: Re: [dba-SQLServer] Views don't sort >>> >>> It means that if you specify "SELECT TOP 5 FROM ALPHABET ORDER BY >>> LETTER", >>> you >>> will always get A,B,C,D and E, but they may not necessarily be in that >>> order. They may be >>> returned as "E,D,C,B,A", "D,B,A,E,C" etc. >>> >>> Although it has worked up til now, it is just like any other hack that >>> uses >>> "undocumented >>> features". - after the next patch, hotfix or service pack, you may find >>> that it no longer works >>> that way - the same records could be returned in a completely different >>> sort order, possibly by >>> PK or by the order in which they are physically stored on disk. >>> >>> -- >>> Stuart >>> >>> On 21 May 2011 at 0:09, Asger Blond wrote: >>> >>> Well, and this quote from BOL just doesn't make any sense to me. The >>>> TOP and ORDER BY clause is used to "determine the rows returned", but >>>> it "does not guarantee ordered results" - WTF does this mean? I use >>>> the construct specified by Francisco, and have never seen problems. >>>> Asger >>>> >>>> -----Oprindelig meddelelse----- >>>> Fra: dba-sqlserver-bounces at databaseadvisors.com >>>> [mailto:dba-sqlserver-bounces at databaseadvisors.com] P? vegne af >>>> Stuart McLachlan Sendt: 20. maj 2011 22:48 Til: Discussion concerning >>>> MS SQL Server Emne: Re: [dba-SQLServer] Views don't sort >>>> >>>> Be careful with that. It is not guaranteed to work! >>>> >>>> See http://msdn.microsoft.com/en-us/library/ms188385.aspx >>>> >>>> The ORDER BY clause is not valid in views, inline functions, derived >>>> tables, and subqueries, unless TOP is also specified. ... When ORDER >>>> BY is used in the definition of a view, inline function, derived >>>> table, or subquery, the clause is used only to determine the rows >>>> returned by the TOP clause. The ORDER BY clause does not guarantee >>>> ordered results when these constructs are queried, unless ORDER BY is >>>> also specified in the query itself >>>> >>>> The only way to be sure is to use "Select * from vwMyView Order by >>>> colMyCol" >>>> >>>> -- >>>> Stuart >>>> >>>> On 20 May 2011 at 13:31, jwcolby wrote: >>>> >>>> Francisco, >>>>> >>>>> I apparently ignored your top 99.999% part. >>>>> >>>>> When I went back in to my view and selected top 1 million (very big) >>>>> it did in fact return a sorted data set. >>>>> >>>>> Thanks! >>>>> >>>>> John W. Colby >>>>> www.ColbyConsulting.com >>>>> >>>>> On 5/20/2011 1:07 PM, Francisco Tapia wrote: >>>>> >>>>>> So something like: >>>>>> >>>>>> Create View vwSomeView AS >>>>>> Select TOP 99.9999 percent Field1, Field2, Field3 >>>>>> >>>>>>> From tblSomeTable >>>>>>> >>>>>> Order by Field3 >>>>>> >>>>>> does not sort field3? what are your results when you just select >>>>>> * from vwSomeView ? are the results sorted in your results >>>>>> display in management studio? >>>>>> >>>>>> >>>>>> -Francisco >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> On Fri, May 20, 2011 at 10:02 AM, >>>>>> jwcolbywrote: >>>>>> >>>>>> One of the things I am trying to do is use SQL Server to speed up >>>>>>> my applications. The theory is that I can hand off the heavy >>>>>>> lifting to SQL Server and just get back result sets. Of course >>>>>>> this works in terms of joins and filters in a view, but even >>>>>>> though I specify a sort in a view, when the result set hits the >>>>>>> other end (Access in my case) it is unsorted. >>>>>>> >>>>>>> Views have the ability to do sorts, so why is the data returned >>>>>>> by a view into a third party app, or even into another view in >>>>>>> SQL Server unsorted? >>>>>>> Is there a way to tell sql server to return sorted data? >>>>>>> >>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>> dba-SQLServer mailing list >>>>>> dba-SQLServer at databaseadvisors.com >>>>>> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >>>>>> http://www.databaseadvisors.com >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>> dba-SQLServer mailing list >>>>> dba-SQLServer at databaseadvisors.com >>>>> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >>>>> http://www.databaseadvisors.com >>>>> >>>>> >>>>> >>>> >>>> >>>> _______________________________________________ >>>> dba-SQLServer mailing list >>>> dba-SQLServer at databaseadvisors.com >>>> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >>>> http://www.databaseadvisors.com >>>> >>>> >>>> _______________________________________________ >>>> dba-SQLServer mailing list >>>> dba-SQLServer at databaseadvisors.com >>>> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >>>> http://www.databaseadvisors.com >>>> >>>> >>> >>> >>> >>> _______________________________________________ >>> dba-SQLServer mailing list >>> dba-SQLServer at databaseadvisors.com >>> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >>> http://www.databaseadvisors.com >>> >>> >>> _______________________________________________ >>> dba-SQLServer mailing list >>> dba-SQLServer at databaseadvisors.com >>> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >>> http://www.databaseadvisors.com >>> >>> >>> _______________________________________________ >> dba-SQLServer mailing list >> dba-SQLServer at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >> http://www.databaseadvisors.com >> >> >> _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > >