From nancy.lytle at gmail.com Wed Oct 1 06:59:03 2008 From: nancy.lytle at gmail.com (Nancy Lytle) Date: Wed, 1 Oct 2008 06:59:03 -0500 Subject: [dba-SQLServer] Insufficient information about deadlocks In-Reply-To: <29f585dd0809301308q493546b5med1a3ea8e3ac43f9@mail.gmail.com> References: <29f585dd0809300715t2347d9beifd3272593393a072@mail.gmail.com> <29f585dd0809301308q493546b5med1a3ea8e3ac43f9@mail.gmail.com> Message-ID: Where should I send it?Nancy Lytle N_Lytle at terpalum.umd.edu EMAILING FOR THE GREATER GOODJoin me > Date: Tue, 30 Sep 2008 17:08:13 -0300> From: fuller.artful at gmail.com> To: dba-sqlserver at databaseadvisors.com> Subject: Re: [dba-SQLServer] Insufficient information about deadlocks> > Thanks. I Googled it and got a hit but the link led nowhere. Do you have a> copy that you could send me? It would be appreciated.> > Arthur> > On Tue, Sep 30, 2008 at 4:18 PM, Nancy Lytle wrote:> > > Check out sp_blocker_pss80.sql, I found it on the web. It gives good info> > on blocking and who is blocking what. There are some other ones out there> > but this is the one I use throughout the day to get an eye on things, or I> > use it when there is a complaint about slowness, etc.> > Nancy Lytle N_Lytle at terpalum.umd.edu> >> >> _______________________________________________> 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 Wed Oct 1 07:14:10 2008 From: fuller.artful at gmail.com (Arthur Fuller) Date: Wed, 1 Oct 2008 09:14:10 -0300 Subject: [dba-SQLServer] Insufficient information about deadlocks In-Reply-To: References: <29f585dd0809300715t2347d9beifd3272593393a072@mail.gmail.com> <29f585dd0809301308q493546b5med1a3ea8e3ac43f9@mail.gmail.com> Message-ID: <29f585dd0810010514p64f91054k702fe193706314f2@mail.gmail.com> To me at fuller.artful at gmail.com. Thanks! On Wed, Oct 1, 2008 at 8:59 AM, Nancy Lytle wrote: > Where should I send it?Nancy Lytle N_Lytle at terpalum.umd.edu > > > From fhtapia at gmail.com Wed Oct 1 12:46:17 2008 From: fhtapia at gmail.com (Francisco Tapia) Date: Wed, 1 Oct 2008 10:46:17 -0700 Subject: [dba-SQLServer] Insufficient information about deadlocks In-Reply-To: <29f585dd0810010514p64f91054k702fe193706314f2@mail.gmail.com> References: <29f585dd0809300715t2347d9beifd3272593393a072@mail.gmail.com> <29f585dd0809301308q493546b5med1a3ea8e3ac43f9@mail.gmail.com> <29f585dd0810010514p64f91054k702fe193706314f2@mail.gmail.com> Message-ID: I'm curious about that too... can you forward me a copy at fhtapia at gmail.com -Francisco http://sqlthis.blogspot.com | Tsql and More... On Wed, Oct 1, 2008 at 5:14 AM, Arthur Fuller wrote: > To me at fuller.artful at gmail.com. > > Thanks! > > On Wed, Oct 1, 2008 at 8:59 AM, Nancy Lytle wrote: > > > Where should I send it?Nancy Lytle N_Lytle at terpalum.umd.edu > > > > > > > _______________________________________________ > 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 Wed Oct 1 14:56:40 2008 From: fhtapia at gmail.com (Francisco Tapia) Date: Wed, 1 Oct 2008 12:56:40 -0700 Subject: [dba-SQLServer] Automatic drop of everything related to a table In-Reply-To: <29f585dd0809261009g310bd257u940e5ecfe8998bfe@mail.gmail.com> References: <29f585dd0809261009g310bd257u940e5ecfe8998bfe@mail.gmail.com> Message-ID: Arthur, Yes, all Constraints, Triggers, Indexes are dropped, however if you are trying to drop a child table, you need to break the relationship first before you drop said table. -Francisco http://sqlthis.blogspot.com | Tsql and More... On Fri, Sep 26, 2008 at 10:09 AM, Arthur Fuller wrote: > When you drop a table, do all related objects automatically get dropped as > well? By "related objects" I don't mean related tables, but rather > constraints, triggers, indexes and so on. Does dropping a table > automatically kill all this stuff, or do remnants persist, and if the > latter, is there some systematic way of killing all the remnants when I > kill > the table? > > You might wonder why I want to do this. I'd tell you but then I'd have to > kill you. (It's Friday. so I may let you live until Monday.) > > A. > > From mikedorism at verizon.net Wed Oct 1 16:00:03 2008 From: mikedorism at verizon.net (Doris Manning) Date: Wed, 01 Oct 2008 17:00:03 -0400 Subject: [dba-SQLServer] Insufficient information about deadlocks In-Reply-To: References: <29f585dd0809300715t2347d9beifd3272593393a072@mail.gmail.com> <29f585dd0809301308q493546b5med1a3ea8e3ac43f9@mail.gmail.com> Message-ID: <7D7BA8DB01E643B88506A09869533A10@Kermit> Can I have a copy too? mikedorism at verizon.net Doris -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Nancy Lytle Sent: Wednesday, October 01, 2008 7:59 AM To: Discussion concerning MS SQL Server Subject: Re: [dba-SQLServer] Insufficient information about deadlocks Where should I send it?Nancy Lytle N_Lytle at terpalum.umd.edu EMAILING FOR THE GREATER GOODJoin me > Date: Tue, 30 Sep 2008 17:08:13 -0300> From: fuller.artful at gmail.com> To: dba-sqlserver at databaseadvisors.com> Subject: Re: [dba-SQLServer] Insufficient information about deadlocks> > Thanks. I Googled it and got a hit but the link led nowhere. Do you have a> copy that you could send me? It would be appreciated.> > Arthur> > On Tue, Sep 30, 2008 at 4:18 PM, Nancy Lytle wrote:> > > Check out sp_blocker_pss80.sql, I found it on the web. It gives good info> > on blocking and who is blocking what. There are some other ones out there> > but this is the one I use throughout the day to get an eye on things, or I> > use it when there is a complaint about slowness, etc.> > Nancy Lytle N_Lytle at terpalum.umd.edu> >> >> _______________________________________________> 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 Thu Oct 2 15:59:57 2008 From: fuller.artful at gmail.com (Arthur Fuller) Date: Thu, 2 Oct 2008 17:59:57 -0300 Subject: [dba-SQLServer] This is a cute little gotcha Message-ID: <29f585dd0810021359n70fc25d8te8902607591a9733@mail.gmail.com> Abbreviated code, enough to give the gist without the gory details.... DECLARE @statement VARCHAR(255) -- Build Cursor of Alter Index Statements DECLARE Statement_Cursor CURSOR FOR SELECT 'UPDATE STATISTICS [' + SCHEMA_NAME() + '].[' + sysobjects.NAME + ']' FROM sysobjects WHERE TYPE = 'U' -- user tables OPEN Statement_Cursor FETCH NEXT FROM Statement_Cursor INTO @statement etc. This code generates a series of statements like: UPDATE STATISTICS [dbo].[BESTAction] What is interesting is that this construction calls Schema_Name() just once and it returns "dbo". But this is not appropriate for a db such as AdventureWorks which is subdivided into many schemas. I notice in the sysobjects table that there is a column called uid which corresponds to the schemas but I don't know where it points. That would seem a workable solution to this problem. Arthur From Darryl.Collins at coles.com.au Thu Oct 2 22:40:20 2008 From: Darryl.Collins at coles.com.au (Darryl Collins) Date: Fri, 3 Oct 2008 13:40:20 +1000 Subject: [dba-SQLServer] Passing a valid date to a sproc In-Reply-To: <29f585dd0810021359n70fc25d8te8902607591a9733@mail.gmail.com> Message-ID: <57E6E6CA42105A48B977303A2CDC2720076DA2702B@WPEXCH22.retail.ad.cmltd.net.au> Hi folks, *$##!@!! date Formats. They get me everytime. wow, not sure where to start. I have a stored proc that I am feeding variable to via a SQL string from Excel. On of the values is a date that is formatted in Aussie Style (that dd/mm/yyyy). The sproc fails as it is reading the date as mm/dd/yyyy so any date that i have where the dd bit is > 12 it fails. How can i ensure that the date passed is in an acceptable format? For example, this line will pass (although wrongly I suspect as July 9, 2008) stprPopulateCRSActuals 7437, 'Robyn X', 'Freeman', 4.875, 'A050', 3, '7/09/2008', 'HCSMVO', '24227', 'ISO', '2', '2', 'HCSMVO', 'IS0001', 'Problem', 'Staff', 2295.93, 2295.93, 58.87, 0, 7, 74, 1, 2 But this one will fail stprPopulateCRSActuals 7437, 'Robyn X', 'Freeman', 4.625, 'A050', 3, '14/09/2008', 'HCSMVO', '24227', 'ISO', '2', '2', 'HCSMVO', 'IS0001', 'Problem', 'Staff', 2178.19, 2178.19, 58.87, 0, 7, 74, 1, 2 because the date is 14/09/2008 (dd/mm/yyyy) and being read as (mm/dd/yyyy). cheers Darryl. This email and any attachments may contain privileged and confidential information and are intended for the named addressee only. If you have received this e-mail in error, please notify the sender and delete this e-mail immediately. Any confidentiality, privilege or copyright is not waived or lost because this e-mail has been sent to you in error. It is your responsibility to check this e-mail and any attachments for viruses. No warranty is made that this material is free from computer virus or any other defect or error. Any loss/damage incurred by using this material is not the sender's responsibility. The sender's entire liability will be limited to resupplying the material. From Darryl.Collins at coles.com.au Thu Oct 2 22:59:02 2008 From: Darryl.Collins at coles.com.au (Darryl Collins) Date: Fri, 3 Oct 2008 13:59:02 +1000 Subject: [dba-SQLServer] Passing a valid date to a sproc In-Reply-To: <57E6E6CA42105A48B977303A2CDC2720076DA2702B@WPEXCH22.retail.ad.cmltd.net.au> Message-ID: <57E6E6CA42105A48B977303A2CDC2720076DA2702D@WPEXCH22.retail.ad.cmltd.net.au> Ok.... Found this in help "CONVERT(DATETIME, '7/19/1996', 103)" and it looks promising, but I have no idea where to put it into the sproc to make it actually work. All my attempts have been rather pathetic and ended in total and abject failure. The example shown in help is related to a query rather than fixing it up in a sproc - all rather new to this so sorry if this is a dumb question. hmmm.. :-/ Here is the sproc if it will help.... '==================================================================================== if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[stprPopulateCRSActuals]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[stprPopulateCRSActuals] GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO /* Name: stprPopulateCRSActuals Description: Populate the CRS Actuals table from the Excel Uploader file. Author: Darryl collins Modification Log: Change Description Date Changed By Created procedure 03-Oct-2008 Darryl Collins */ CREATE PROCEDURE dbo.stprPopulateCRSActuals @EmployeeID int, @EmployeeFirstName nvarchar (100), @EmployeeSurname nvarchar (100), @Effort float, @ProductCode nvarchar (6), @ApprovePeriod int, @WeekEnding datetime, @CostCentreCode nvarchar (20), @ProjectID int, @HomeDepartmentCode nvarchar (10), @ProductTypeID int, @ProducGroupID int, @HomeCostCentre nvarchar (20), @TaskID nvarchar (20), @TaskName nvarchar (255), @AccountsCategoryDescription nvarchar (20), @CRSValue money, @Capex money, @ChargeOutRate money, @Opex money, @FYID int, @FYPID int, @MECID int, @ForecastStatusID int AS INSERT INTO dbo.ITFCT_tblActualCRS_Effort (EmployeeID, EmployeeFirstName, EmployeeSurname, Effort, ProductCode, ApprovePeriod, WeekEnding, CostCentreCode, ProjectID, HomeDepartmentCode, ProductTypeID, ProducGroupID, HomeCostCentre, TaskID, TaskName, AccountsCategoryDescription, CRSValue, Capex, ChargeOutRate, Opex, FYID, FYPID, MECID, ForecastStatusID) VALUES (@EmployeeID, @EmployeeFirstName, @EmployeeSurname, @Effort, @ProductCode, @ApprovePeriod, @WeekEnding, @CostCentreCode, @ProjectID, @HomeDepartmentCode, @ProductTypeID, @ProducGroupID, @HomeCostCentre, @TaskID, @TaskName, @AccountsCategoryDescription, @CRSValue, @Capex, @ChargeOutRate, @Opex, @FYID, @FYPID, @MECID, @ForecastStatusID) SELECT 0 AS Result GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO '==================================================================== -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of Darryl Collins Sent: Friday, 3 October 2008 1:40 PM To: 'Discussion concerning MS SQL Server' Subject: [dba-SQLServer] Passing a valid date to a sproc Hi folks, *$##!@!! date Formats. They get me everytime. wow, not sure where to start. I have a stored proc that I am feeding variable to via a SQL string from Excel. On of the values is a date that is formatted in Aussie Style (that dd/mm/yyyy). The sproc fails as it is reading the date as mm/dd/yyyy so any date that i have where the dd bit is > 12 it fails. How can i ensure that the date passed is in an acceptable format? For example, this line will pass (although wrongly I suspect as July 9, 2008) stprPopulateCRSActuals 7437, 'Robyn X', 'Freeman', 4.875, 'A050', 3, '7/09/2008', 'HCSMVO', '24227', 'ISO', '2', '2', 'HCSMVO', 'IS0001', 'Problem', 'Staff', 2295.93, 2295.93, 58.87, 0, 7, 74, 1, 2 But this one will fail stprPopulateCRSActuals 7437, 'Robyn X', 'Freeman', 4.625, 'A050', 3, '14/09/2008', 'HCSMVO', '24227', 'ISO', '2', '2', 'HCSMVO', 'IS0001', 'Problem', 'Staff', 2178.19, 2178.19, 58.87, 0, 7, 74, 1, 2 because the date is 14/09/2008 (dd/mm/yyyy) and being read as (mm/dd/yyyy). cheers Darryl. This email and any attachments may contain privileged and confidential information and are intended for the named addressee only. If you have received this e-mail in error, please notify the sender and delete this e-mail immediately. Any confidentiality, privilege or copyright is not waived or lost because this e-mail has been sent to you in error. It is your responsibility to check this e-mail and any attachments for viruses. No warranty is made that this material is free from computer virus or any other defect or error. Any loss/damage incurred by using this material is not the sender's responsibility. The sender's entire liability will be limited to resupplying the material. _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com This email and any attachments may contain privileged and confidential information and are intended for the named addressee only. If you have received this e-mail in error, please notify the sender and delete this e-mail immediately. Any confidentiality, privilege or copyright is not waived or lost because this e-mail has been sent to you in error. It is your responsibility to check this e-mail and any attachments for viruses. No warranty is made that this material is free from computer virus or any other defect or error. Any loss/damage incurred by using this material is not the sender's responsibility. The sender's entire liability will be limited to resupplying the material. From stuart at lexacorp.com.pg Thu Oct 2 23:55:25 2008 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Fri, 03 Oct 2008 14:55:25 +1000 Subject: [dba-SQLServer] Passing a valid date to a sproc In-Reply-To: <57E6E6CA42105A48B977303A2CDC2720076DA2702D@WPEXCH22.retail.ad.cmltd.net.au> References: <57E6E6CA42105A48B977303A2CDC2720076DA2702B@WPEXCH22.retail.ad.cmltd.net.au>, <57E6E6CA42105A48B977303A2CDC2720076DA2702D@WPEXCH22.retail.ad.cmltd.net.au> Message-ID: <48E6325D.29490.17BD82C@stuart.lexacorp.com.pg> Unfortunately, 103 etc is for converting from DATETIME to a string, not the other way round. IF you are stuck with passing "dd/mm/yyyy" you will have to do something like @WeekEnding CHAR(10) .... DIm @WeekEndingDate DATETIME .... @WeekEndingDate = SUBSTRING ( @WeekEnding , 4 , 2 ) + '/' + SUBSTRING ( @Weekending , 1 , 2 ) + '/' +SUBSTRING ( @Weekending , 7 , 4 ) ...... VALUES( ..... @WeekEndingDate ...... > > Ok.... Found this in help "CONVERT(DATETIME, '7/19/1996', 103)" and > it looks promising, but I have no idea where to put it into the sproc > to make it actually work. All my attempts have been rather pathetic > and ended in total and abject failure. The example shown in help is > related to a query rather than fixing it up in a sproc - all rather > new to this so sorry if this is a dumb question. hmmm.. :-/ From stuart at lexacorp.com.pg Thu Oct 2 23:55:41 2008 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Fri, 03 Oct 2008 14:55:41 +1000 Subject: [dba-SQLServer] Passing a valid date to a sproc In-Reply-To: <57E6E6CA42105A48B977303A2CDC2720076DA2702B@WPEXCH22.retail.ad.cmltd.net.au> References: <29f585dd0810021359n70fc25d8te8902607591a9733@mail.gmail.com>, <57E6E6CA42105A48B977303A2CDC2720076DA2702B@WPEXCH22.retail.ad.cmltd.net.au> Message-ID: <48E6326D.24915.17C1501@stuart.lexacorp.com.pg> Simplest way is to pass them formatted as "7 Sep 2008" If you are building and passing the string in Excel VBA, use the Format() function just as you would in Access ie strSQL = .....& Format(R1C1,"d mmm yyyy") & ..... On 3 Oct 2008 at 13:40, Darryl Collins wrote: > Hi folks, > > *$##!@!! date Formats. They get me everytime. wow, not sure where to start. > > I have a stored proc that I am feeding variable to via a SQL string > from Excel. On of the values is a date that is formatted in Aussie > Style (that dd/mm/yyyy). The sproc fails as it is reading the date as > mm/dd/yyyy so any date that i have where the dd bit is > 12 it fails. > > How can i ensure that the date passed is in an acceptable format? > > For example, this line will pass (although wrongly I suspect as July 9, 2008) > stprPopulateCRSActuals 7437, 'Robyn X', 'Freeman', 4.875, 'A050', 3, '7/09/2008', 'HCSMVO', '24227', 'ISO', '2', '2', 'HCSMVO', 'IS0001', 'Problem', 'Staff', 2295.93, 2295.93, 58.87, 0, 7, 74, 1, 2 > > But this one will fail > > stprPopulateCRSActuals 7437, 'Robyn X', 'Freeman', 4.625, 'A050', 3, '14/09/2008', 'HCSMVO', '24227', 'ISO', '2', '2', 'HCSMVO', 'IS0001', 'Problem', 'Staff', 2178.19, 2178.19, 58.87, 0, 7, 74, 1, 2 > > because the date is 14/09/2008 (dd/mm/yyyy) and being read as (mm/dd/yyyy). > > cheers > Darryl. > > > This email and any attachments may contain privileged and confidential information > and are intended for the named addressee only. If you have received this e-mail in > error, please notify the sender and delete this e-mail immediately. Any > confidentiality, privilege or copyright is not waived or lost because this e-mail > has been sent to you in error. It is your responsibility to check this e-mail and > any attachments for viruses. No warranty is made that this material is free from > computer virus or any other defect or error. Any loss/damage incurred by using this > material is not the sender's responsibility. The sender's entire liability will be > limited to resupplying the material. > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > From Darryl.Collins at coles.com.au Fri Oct 3 00:24:42 2008 From: Darryl.Collins at coles.com.au (Darryl Collins) Date: Fri, 3 Oct 2008 15:24:42 +1000 Subject: [dba-SQLServer] Passing a valid date to a sproc In-Reply-To: <48E6326D.24915.17C1501@stuart.lexacorp.com.pg> Message-ID: <57E6E6CA42105A48B977303A2CDC2720076DA2702E@WPEXCH22.retail.ad.cmltd.net.au> took the "KISS" approach and hey! it works really well. Feel like a goose as I should have tried/thought of that. If I ever get to PNG, i owe you a few bottles of your fav one afternoon. Many thanks :) cheers Darryl -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of Stuart McLachlan Sent: Friday, 3 October 2008 2:56 PM To: Discussion concerning MS SQL Server Subject: Re: [dba-SQLServer] Passing a valid date to a sproc Simplest way is to pass them formatted as "7 Sep 2008" If you are building and passing the string in Excel VBA, use the Format() function just as you would in Access ie strSQL = .....& Format(R1C1,"d mmm yyyy") & ..... On 3 Oct 2008 at 13:40, Darryl Collins wrote: > Hi folks, > > *$##!@!! date Formats. They get me everytime. wow, not sure where to start. > > I have a stored proc that I am feeding variable to via a SQL string > from Excel. On of the values is a date that is formatted in Aussie > Style (that dd/mm/yyyy). The sproc fails as it is reading the date as > mm/dd/yyyy so any date that i have where the dd bit is > 12 it fails. > > How can i ensure that the date passed is in an acceptable format? > > For example, this line will pass (although wrongly I suspect as July 9, 2008) > stprPopulateCRSActuals 7437, 'Robyn X', 'Freeman', 4.875, 'A050', 3, '7/09/2008', 'HCSMVO', '24227', 'ISO', '2', '2', 'HCSMVO', 'IS0001', 'Problem', 'Staff', 2295.93, 2295.93, 58.87, 0, 7, 74, 1, 2 > > But this one will fail > > stprPopulateCRSActuals 7437, 'Robyn X', 'Freeman', 4.625, 'A050', 3, '14/09/2008', 'HCSMVO', '24227', 'ISO', '2', '2', 'HCSMVO', 'IS0001', 'Problem', 'Staff', 2178.19, 2178.19, 58.87, 0, 7, 74, 1, 2 > > because the date is 14/09/2008 (dd/mm/yyyy) and being read as (mm/dd/yyyy). > > cheers > Darryl. > > > This email and any attachments may contain privileged and confidential information > and are intended for the named addressee only. If you have received this e-mail in > error, please notify the sender and delete this e-mail immediately. Any > confidentiality, privilege or copyright is not waived or lost because this e-mail > has been sent to you in error. It is your responsibility to check this e-mail and > any attachments for viruses. No warranty is made that this material is free from > computer virus or any other defect or error. Any loss/damage incurred by using this > material is not the sender's responsibility. The sender's entire liability will be > limited to resupplying the material. > > > _______________________________________________ > 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 This email and any attachments may contain privileged and confidential information and are intended for the named addressee only. If you have received this e-mail in error, please notify the sender and delete this e-mail immediately. Any confidentiality, privilege or copyright is not waived or lost because this e-mail has been sent to you in error. It is your responsibility to check this e-mail and any attachments for viruses. No warranty is made that this material is free from computer virus or any other defect or error. Any loss/damage incurred by using this material is not the sender's responsibility. The sender's entire liability will be limited to resupplying the material. From Gustav at cactus.dk Fri Oct 3 01:42:00 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Fri, 03 Oct 2008 08:42:00 +0200 Subject: [dba-SQLServer] Passing a valid date to a sproc Message-ID: Hi Darryl > All my attempts have been rather pathetic and ended in total and abject failure. At least you are honest about this! That said, as you have control of the source, this is not a KISS method but the right method - to solve the issue at the source. However, the approach with using the spelled out month names is dangerous as these are localized. The preferred format is to use the ISO format: ie strSQL = .....& Format(R1C1,"yyyy-mm-dd") & ..... as it will never fail. /gustav >>> Darryl.Collins at coles.com.au 03-10-2008 07:24 >>> took the "KISS" approach and hey! it works really well. Feel like a goose as I should have tried/thought of that. If I ever get to PNG, i owe you a few bottles of your fav one afternoon. Many thanks :) cheers Darryl -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of Stuart McLachlan Sent: Friday, 3 October 2008 2:56 PM To: Discussion concerning MS SQL Server Subject: Re: [dba-SQLServer] Passing a valid date to a sproc Simplest way is to pass them formatted as "7 Sep 2008" If you are building and passing the string in Excel VBA, use the Format() function just as you would in Access ie strSQL = .....& Format(R1C1,"d mmm yyyy") & ..... On 3 Oct 2008 at 13:40, Darryl Collins wrote: > Hi folks, > > *$##!@!! date Formats. They get me everytime. wow, not sure where to start. > > I have a stored proc that I am feeding variable to via a SQL string > from Excel. On of the values is a date that is formatted in Aussie > Style (that dd/mm/yyyy). The sproc fails as it is reading the date as > mm/dd/yyyy so any date that i have where the dd bit is > 12 it fails. > > How can i ensure that the date passed is in an acceptable format? > > For example, this line will pass (although wrongly I suspect as July 9, 2008) > stprPopulateCRSActuals 7437, 'Robyn X', 'Freeman', 4.875, 'A050', 3, '7/09/2008', 'HCSMVO', '24227', 'ISO', '2', '2', 'HCSMVO', 'IS0001', 'Problem', 'Staff', 2295.93, 2295.93, 58.87, 0, 7, 74, 1, 2 > > But this one will fail > > stprPopulateCRSActuals 7437, 'Robyn X', 'Freeman', 4.625, 'A050', 3, '14/09/2008', 'HCSMVO', '24227', 'ISO', '2', '2', 'HCSMVO', 'IS0001', 'Problem', 'Staff', 2178.19, 2178.19, 58.87, 0, 7, 74, 1, 2 > > because the date is 14/09/2008 (dd/mm/yyyy) and being read as (mm/dd/yyyy). > > cheers > Darryl. From Darryl.Collins at coles.com.au Fri Oct 3 01:45:43 2008 From: Darryl.Collins at coles.com.au (Darryl Collins) Date: Fri, 3 Oct 2008 16:45:43 +1000 Subject: [dba-SQLServer] Passing a valid date to a sproc In-Reply-To: Message-ID: <57E6E6CA42105A48B977303A2CDC2720076DA2702F@WPEXCH22.retail.ad.cmltd.net.au> Noted Gustav, and changed to suit. Many thanks. -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of Gustav Brock Sent: Friday, 3 October 2008 4:42 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Passing a valid date to a sproc Hi Darryl > All my attempts have been rather pathetic and ended in total and abject failure. At least you are honest about this! That said, as you have control of the source, this is not a KISS method but the right method - to solve the issue at the source. However, the approach with using the spelled out month names is dangerous as these are localized. The preferred format is to use the ISO format: ie strSQL = .....& Format(R1C1,"yyyy-mm-dd") & ..... as it will never fail. /gustav >>> Darryl.Collins at coles.com.au 03-10-2008 07:24 >>> took the "KISS" approach and hey! it works really well. Feel like a goose as I should have tried/thought of that. If I ever get to PNG, i owe you a few bottles of your fav one afternoon. Many thanks :) cheers Darryl -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of Stuart McLachlan Sent: Friday, 3 October 2008 2:56 PM To: Discussion concerning MS SQL Server Subject: Re: [dba-SQLServer] Passing a valid date to a sproc Simplest way is to pass them formatted as "7 Sep 2008" If you are building and passing the string in Excel VBA, use the Format() function just as you would in Access ie strSQL = .....& Format(R1C1,"d mmm yyyy") & ..... On 3 Oct 2008 at 13:40, Darryl Collins wrote: > Hi folks, > > *$##!@!! date Formats. They get me everytime. wow, not sure where to start. > > I have a stored proc that I am feeding variable to via a SQL string > from Excel. On of the values is a date that is formatted in Aussie > Style (that dd/mm/yyyy). The sproc fails as it is reading the date as > mm/dd/yyyy so any date that i have where the dd bit is > 12 it fails. > > How can i ensure that the date passed is in an acceptable format? > > For example, this line will pass (although wrongly I suspect as July 9, 2008) > stprPopulateCRSActuals 7437, 'Robyn X', 'Freeman', 4.875, 'A050', 3, '7/09/2008', 'HCSMVO', '24227', 'ISO', '2', '2', 'HCSMVO', 'IS0001', 'Problem', 'Staff', 2295.93, 2295.93, 58.87, 0, 7, 74, 1, 2 > > But this one will fail > > stprPopulateCRSActuals 7437, 'Robyn X', 'Freeman', 4.625, 'A050', 3, '14/09/2008', 'HCSMVO', '24227', 'ISO', '2', '2', 'HCSMVO', 'IS0001', 'Problem', 'Staff', 2178.19, 2178.19, 58.87, 0, 7, 74, 1, 2 > > because the date is 14/09/2008 (dd/mm/yyyy) and being read as (mm/dd/yyyy). > > cheers > Darryl. _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com This email and any attachments may contain privileged and confidential information and are intended for the named addressee only. If you have received this e-mail in error, please notify the sender and delete this e-mail immediately. Any confidentiality, privilege or copyright is not waived or lost because this e-mail has been sent to you in error. It is your responsibility to check this e-mail and any attachments for viruses. No warranty is made that this material is free from computer virus or any other defect or error. Any loss/damage incurred by using this material is not the sender's responsibility. The sender's entire liability will be limited to resupplying the material. From fuller.artful at gmail.com Fri Oct 3 09:46:59 2008 From: fuller.artful at gmail.com (Arthur Fuller) Date: Fri, 3 Oct 2008 11:46:59 -0300 Subject: [dba-SQLServer] Really Interesting puzzle Message-ID: <29f585dd0810030746x70a9d7ah2f0301d44a9d2656@mail.gmail.com> I've just come upon a truly interesting puzzle. It's a problem but the app doesn't have to be done today so we have a window to explore. I have a couple of colleagues to whom I have showed this and so far no one has any idea what is going wrong -- which in a way makes it even more fun than your usual nightmare. I'm reading an ascii file which looks like this: SecurityIDBSID,MessageName,FieldName,DataValue,TimeOfUpdate 678605355511,Summary.Message,Summary.Status.Security.Allow.Quotes,false,10/01/08 11:58:43 678605355511,Summary.Message,Summary.Status.Security.Allow.Trades,false,10/01/08 11:58:43 I'm using the bulk insert command: USE BPOD BULK INSERT dbo.BPOD_Message_Staging2 FROM 's:\arthur files\test\bpod_35A.csv' WITH (FIRSTROW=2,FIELDTERMINATOR=',',ROWTERMINATOR='\n') I was initially having a problem dealing with the TimeOfUpdate values in the incoming file, so I changed the destination table's corresponding column to varchar. Now the result is really interesting. Here is a paste of the first returned row. (The binary data column is a timestamp and irrelevant to this discussion.) 678605355116 Summary.Message Summary.ValueTraded 930752738.810806 10/01/08 11:58:44 678605355116 Notice that the TimeOfUpdate column contains the same number as the first column. It got the date right but then appended the entire second row to that column, failing to see the row delimiter. I've run it a few times now and the pattern is consistent. I'm getting every other row in the destination table. I have checked with our c++ guy to see if he was doing anything out of the ordinary at end of line, and no. I am completely baffled by this one. Anyone got any ideas? TIA, Arthur From Gustav at cactus.dk Fri Oct 3 09:59:01 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Fri, 03 Oct 2008 16:59:01 +0200 Subject: [dba-SQLServer] Really Interesting puzzle Message-ID: Hi Arthur Have you tested this with ROWTERMINATOR='\r\n' ? /gustav >>> fuller.artful at gmail.com 03-10-2008 16:46 >>> I've just come upon a truly interesting puzzle. It's a problem but the app doesn't have to be done today so we have a window to explore. I have a couple of colleagues to whom I have showed this and so far no one has any idea what is going wrong -- which in a way makes it even more fun than your usual nightmare. I'm reading an ascii file which looks like this: SecurityIDBSID,MessageName,FieldName,DataValue,TimeOfUpdate 678605355511,Summary.Message,Summary.Status.Security.Allow.Quotes,false,10/01/08 11:58:43 678605355511,Summary.Message,Summary.Status.Security.Allow.Trades,false,10/01/08 11:58:43 I'm using the bulk insert command: USE BPOD BULK INSERT dbo.BPOD_Message_Staging2 FROM 's:\arthur files\test\bpod_35A.csv' WITH (FIRSTROW=2,FIELDTERMINATOR=',',ROWTERMINATOR='\n') I was initially having a problem dealing with the TimeOfUpdate values in the incoming file, so I changed the destination table's corresponding column to varchar. Now the result is really interesting. Here is a paste of the first returned row. (The binary data column is a timestamp and irrelevant to this discussion.) 678605355116 Summary.Message Summary.ValueTraded 930752738.810806 10/01/08 11:58:44 678605355116 Notice that the TimeOfUpdate column contains the same number as the first column. It got the date right but then appended the entire second row to that column, failing to see the row delimiter. I've run it a few times now and the pattern is consistent. I'm getting every other row in the destination table. I have checked with our c++ guy to see if he was doing anything out of the ordinary at end of line, and no. I am completely baffled by this one. Anyone got any ideas? TIA, Arthur From ab-mi at post3.tele.dk Fri Oct 3 10:08:59 2008 From: ab-mi at post3.tele.dk (Asger Blond) Date: Fri, 3 Oct 2008 17:08:59 +0200 Subject: [dba-SQLServer] Passing a valid date to a sproc In-Reply-To: <57E6E6CA42105A48B977303A2CDC2720076DA2702B@WPEXCH22.retail.ad.cmltd.net.au> Message-ID: <000001c92569$f6b7e350$2101a8c0@AB> Hi Darryl, I think using SET DATEFORMAT is the easiest way - this should work for you: SET DATEFORMAT dmy stprPopulateCRSActuals 7437, 'Robyn X', 'Freeman', 4.625, 'A050', 3, '14/09/2008', 'HCSMVO', '24227', 'ISO', '2', '2', 'HCSMVO', 'IS0001', 'Problem', 'Staff', 2178.19, 2178.19, 58.87, 0, 7, 74, 1, 2 Asger -----Oprindelig meddelelse----- Fra: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] P? vegne af Darryl Collins Sendt: 3. oktober 2008 05:40 Til: 'Discussion concerning MS SQL Server' Emne: [dba-SQLServer] Passing a valid date to a sproc Hi folks, *$##!@!! date Formats. They get me everytime. wow, not sure where to start. I have a stored proc that I am feeding variable to via a SQL string from Excel. On of the values is a date that is formatted in Aussie Style (that dd/mm/yyyy). The sproc fails as it is reading the date as mm/dd/yyyy so any date that i have where the dd bit is > 12 it fails. How can i ensure that the date passed is in an acceptable format? For example, this line will pass (although wrongly I suspect as July 9, 2008) stprPopulateCRSActuals 7437, 'Robyn X', 'Freeman', 4.875, 'A050', 3, '7/09/2008', 'HCSMVO', '24227', 'ISO', '2', '2', 'HCSMVO', 'IS0001', 'Problem', 'Staff', 2295.93, 2295.93, 58.87, 0, 7, 74, 1, 2 But this one will fail stprPopulateCRSActuals 7437, 'Robyn X', 'Freeman', 4.625, 'A050', 3, '14/09/2008', 'HCSMVO', '24227', 'ISO', '2', '2', 'HCSMVO', 'IS0001', 'Problem', 'Staff', 2178.19, 2178.19, 58.87, 0, 7, 74, 1, 2 because the date is 14/09/2008 (dd/mm/yyyy) and being read as (mm/dd/yyyy). cheers Darryl. This email and any attachments may contain privileged and confidential information and are intended for the named addressee only. If you have received this e-mail in error, please notify the sender and delete this e-mail immediately. Any confidentiality, privilege or copyright is not waived or lost because this e-mail has been sent to you in error. It is your responsibility to check this e-mail and any attachments for viruses. No warranty is made that this material is free from computer virus or any other defect or error. Any loss/damage incurred by using this material is not the sender's responsibility. The sender's entire liability will be limited to resupplying the material. _______________________________________________ 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 Fri Oct 3 10:43:38 2008 From: fuller.artful at gmail.com (Arthur Fuller) Date: Fri, 3 Oct 2008 12:43:38 -0300 Subject: [dba-SQLServer] Really Interesting puzzle In-Reply-To: References: Message-ID: <29f585dd0810030843t65be2115h3cf791e6bb5ee96f@mail.gmail.com> No I haven't but I will in a moment. Ok just did, and it didn't work. But even stranger, I removed the \r, returning my file to its original state. I then removed the timestamp column at the end of the table, and then re-ran the bulk insert statement and it worked! Maybe my CPU just needed a lunch break. This is why they pay us the big bucks -- because we have lots of friends, and no idea what we're doing, but collectively it works. LOL. Thanks, Arthur On Fri, Oct 3, 2008 at 11:59 AM, Gustav Brock wrote: > Hi Arthur > > Have you tested this with > > ROWTERMINATOR='\r\n' > > ? > > /gustav > From fuller.artful at gmail.com Fri Oct 3 12:12:43 2008 From: fuller.artful at gmail.com (Arthur Fuller) Date: Fri, 3 Oct 2008 14:12:43 -0300 Subject: [dba-SQLServer] Question about the transaction log Message-ID: <29f585dd0810031012x2d9eefc5s1ce487d128de77a3@mail.gmail.com> Suppose that I issue an ALTER INDEX ALL REBUILD command. Does stuff get written to the transaction log? If so, can I turn that off, and then turn it back on after I have rebuilt the indexes? I looked in Paul Nielsen's SQL Bible and found nothing relevant. Tried BOL as well and nothing emerged. Arthur From jlawrenc1 at shaw.ca Fri Oct 3 13:16:12 2008 From: jlawrenc1 at shaw.ca (Jim Lawrence) Date: Fri, 3 Oct 2008 11:16:12 -0700 Subject: [dba-SQLServer] Really Interesting puzzle In-Reply-To: <29f585dd0810030746x70a9d7ah2f0301d44a9d2656@mail.gmail.com> References: <29f585dd0810030746x70a9d7ah2f0301d44a9d2656@mail.gmail.com> Message-ID: Hi Arthur: Here is a suggestion that is a bit of a stretch. I ran into a similar problem when manipulating data that came from a UNIX server. The End-of-row symbol is different from the standard symbol used in the Windows environment. Linux uses LF (chr 10) and Windows uses CR (chr 13). Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller Sent: Friday, October 03, 2008 7:47 AM To: Discussion concerning MS SQL Server Subject: [dba-SQLServer] Really Interesting puzzle I've just come upon a truly interesting puzzle. It's a problem but the app doesn't have to be done today so we have a window to explore. I have a couple of colleagues to whom I have showed this and so far no one has any idea what is going wrong -- which in a way makes it even more fun than your usual nightmare. I'm reading an ascii file which looks like this: SecurityIDBSID,MessageName,FieldName,DataValue,TimeOfUpdate 678605355511,Summary.Message,Summary.Status.Security.Allow.Quotes,false,10/0 1/08 11:58:43 678605355511,Summary.Message,Summary.Status.Security.Allow.Trades,false,10/0 1/08 11:58:43 I'm using the bulk insert command: USE BPOD BULK INSERT dbo.BPOD_Message_Staging2 FROM 's:\arthur files\test\bpod_35A.csv' WITH (FIRSTROW=2,FIELDTERMINATOR=',',ROWTERMINATOR='\n') I was initially having a problem dealing with the TimeOfUpdate values in the incoming file, so I changed the destination table's corresponding column to varchar. Now the result is really interesting. Here is a paste of the first returned row. (The binary data column is a timestamp and irrelevant to this discussion.) 678605355116 Summary.Message Summary.ValueTraded 930752738.810806 10/01/08 11:58:44 678605355116 Notice that the TimeOfUpdate column contains the same number as the first column. It got the date right but then appended the entire second row to that column, failing to see the row delimiter. I've run it a few times now and the pattern is consistent. I'm getting every other row in the destination table. I have checked with our c++ guy to see if he was doing anything out of the ordinary at end of line, and no. I am completely baffled by this one. Anyone got any ideas? 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 Fri Oct 3 13:15:20 2008 From: fuller.artful at gmail.com (Arthur Fuller) Date: Fri, 3 Oct 2008 15:15:20 -0300 Subject: [dba-SQLServer] Really Interesting puzzle In-Reply-To: References: <29f585dd0810030746x70a9d7ah2f0301d44a9d2656@mail.gmail.com> Message-ID: <29f585dd0810031115r31c05582je82fec46c78cd988@mail.gmail.com> Thanks for the suggestion but the data doesn't originate from unix. However, as I previously stated, I did work around the problem with a bizarre solution. Don't know why it worked but it worked. On Fri, Oct 3, 2008 at 3:16 PM, Jim Lawrence wrote: > Hi Arthur: > > Here is a suggestion that is a bit of a stretch. > > I ran into a similar problem when manipulating data that came from a UNIX > server. The End-of-row symbol is different from the standard > symbol used in the Windows environment. Linux uses LF > (chr > 10) and Windows uses CR (chr 13). > > Jim > From fuller.artful at gmail.com Fri Oct 3 15:09:54 2008 From: fuller.artful at gmail.com (Arthur Fuller) Date: Fri, 3 Oct 2008 17:09:54 -0300 Subject: [dba-SQLServer] Really Interesting puzzle In-Reply-To: <29f585dd0810031115r31c05582je82fec46c78cd988@mail.gmail.com> References: <29f585dd0810030746x70a9d7ah2f0301d44a9d2656@mail.gmail.com> <29f585dd0810031115r31c05582je82fec46c78cd988@mail.gmail.com> Message-ID: <29f585dd0810031309t7112fcdbvd4923a87f7e4dc12@mail.gmail.com> Ok I have all the glitches sorted out. It required a change or two on the incoming side (creation of the source files from the stream) and a change or two on the destination side, but we're there. On to the next problem... The c++ program reads the stream and periodically writes an ascii file, which I then inhale using Bulk Insert. This part is insanely fast, I can't believe how fast it is. The c++ part creates an in-memory database and then periodically writes an ascii file. At that point, I grab the file and to the bulk insert. Although the insert only takes seconds, it could well happen that more ascii files appear. So the directory may at any moment contain N files, to be processed in sequence. The current plan is to grab the first file, inhale it, move it to another directory, and repeat. The files are going to have names such as xxx_20081103_01.csv. And then 02 and so on. I'm pondering how to know the next file to open. I suppose that if I read the directory list sorted by name or date that will give me the earliest file, and then I can just pass that name to the sproc that calls Bulk Insert. But before I code it, I thought to ask you wizards if you can see any holes in this approach. TIA, Arthur From gustav at cactus.dk Fri Oct 3 15:49:52 2008 From: gustav at cactus.dk (Gustav Brock) Date: Fri, 03 Oct 2008 22:49:52 +0200 Subject: [dba-SQLServer] Really Interesting puzzle Message-ID: Hi Arthur I don't see a problem with that approach. However, no matter how fast your C++ part is, the "disk part" may be slower which means it takes a fraction of time to create, write and close the file; a chance exists that the bulk insert will start reading a file before it has been closed. This can be avoided by creating the file with another name, say xxx_20081103_01.tmp, and then let the C++ part rename it after it has been closed to .csv. /gustav >>> fuller.artful at gmail.com 03-10-2008 22:09 >>> Ok I have all the glitches sorted out. It required a change or two on the incoming side (creation of the source files from the stream) and a change or two on the destination side, but we're there. On to the next problem... The c++ program reads the stream and periodically writes an ascii file, which I then inhale using Bulk Insert. This part is insanely fast, I can't believe how fast it is. The c++ part creates an in-memory database and then periodically writes an ascii file. At that point, I grab the file and to the bulk insert. Although the insert only takes seconds, it could well happen that more ascii files appear. So the directory may at any moment contain N files, to be processed in sequence. The current plan is to grab the first file, inhale it, move it to another directory, and repeat. The files are going to have names such as xxx_20081103_01.csv. And then 02 and so on. I'm pondering how to know the next file to open. I suppose that if I read the directory list sorted by name or date that will give me the earliest file, and then I can just pass that name to the sproc that calls Bulk Insert. But before I code it, I thought to ask you wizards if you can see any holes in this approach. TIA, Arthur From fuller.artful at gmail.com Fri Oct 3 17:41:02 2008 From: fuller.artful at gmail.com (Arthur Fuller) Date: Fri, 3 Oct 2008 19:41:02 -0300 Subject: [dba-SQLServer] Really Interesting puzzle In-Reply-To: References: Message-ID: <29f585dd0810031541i124103f1p92c719697847457@mail.gmail.com> Interesting. Thanks for your "second pair of eyes" on this problem. Arthur On Fri, Oct 3, 2008 at 5:49 PM, Gustav Brock wrote: > Hi Arthur > > I don't see a problem with that approach. > > However, no matter how fast your C++ part is, the "disk part" may be slower > which means it takes a fraction of time to create, write and close the file; > a chance exists that the bulk insert will start reading a file before it has > been closed. > This can be avoided by creating the file with another name, say > xxx_20081103_01.tmp, and then let the C++ part rename it after it has been > closed to .csv. > > /gustav > From Darryl.Collins at coles.com.au Sun Oct 5 18:36:37 2008 From: Darryl.Collins at coles.com.au (Darryl Collins) Date: Mon, 6 Oct 2008 10:36:37 +1100 Subject: [dba-SQLServer] Call a DTS Package via sproc(?) from VBA... In-Reply-To: <29f585dd0810031541i124103f1p92c719697847457@mail.gmail.com> Message-ID: <57E6E6CA42105A48B977303A2CDC2720076DA27034@WPEXCH22.retail.ad.cmltd.net.au> Hi all, Been thinking over the weekend (I know - scarey hey!). I have data in an excel workbook which is set up nice and clean to mirror the SQL table. I am currently using VBA to call a sproc which is writing that data (Line x line via ADO) into SQL Server. This works great, although it is kinda slow (maybe 45 seconds for 20,000 lines of data). I notice when I use DTS to import data it is much faster (and easier too, as the package is already saved). sooo... in this instance I already have the DTS Package set up. The Excel file is going to be in a known location with a known name range to import in a SQL Table. Can I execute the DTS package as part of a sproc? or maybe even directly from Excel's VBA code? I guess the other issue is (since others will be doing this). Will there be any security 'gotchas' I should consider? Any thoughts? cheers Darryl This email and any attachments may contain privileged and confidential information and are intended for the named addressee only. If you have received this e-mail in error, please notify the sender and delete this e-mail immediately. Any confidentiality, privilege or copyright is not waived or lost because this e-mail has been sent to you in error. It is your responsibility to check this e-mail and any attachments for viruses. No warranty is made that this material is free from computer virus or any other defect or error. Any loss/damage incurred by using this material is not the sender's responsibility. The sender's entire liability will be limited to resupplying the material. From markamatte at hotmail.com Mon Oct 6 10:02:13 2008 From: markamatte at hotmail.com (Mark A Matte) Date: Mon, 6 Oct 2008 15:02:13 +0000 Subject: [dba-SQLServer] Really Interesting puzzle In-Reply-To: <29f585dd0810031309t7112fcdbvd4923a87f7e4dc12@mail.gmail.com> References: <29f585dd0810030746x70a9d7ah2f0301d44a9d2656@mail.gmail.com> <29f585dd0810031115r31c05582je82fec46c78cd988@mail.gmail.com> <29f585dd0810031309t7112fcdbvd4923a87f7e4dc12@mail.gmail.com> Message-ID: Arthur, I have a system that generates letters and postcards...every night it receives a text file for letters to be processed. The users process twice a week...and it needs to be in order. I'm assuming the numbers in the example you gave are a date. In the file I receive, the date is part of the file name. My system nows what files contained what data and when processed...a file should be generated every day...so by looking at the date part of the name...the system always knows what file should be processed next. Not sure if it helps...just the approach I use. Thanks, Mark > Date: Fri, 3 Oct 2008 17:09:54 -0300 > From: fuller.artful at gmail.com > To: dba-sqlserver at databaseadvisors.com > Subject: Re: [dba-SQLServer] Really Interesting puzzle > > Ok I have all the glitches sorted out. It required a change or two on the > incoming side (creation of the source files from the stream) and a change or > two on the destination side, but we're there. On to the next problem... > > The c++ program reads the stream and periodically writes an ascii file, > which I then inhale using Bulk Insert. This part is insanely fast, I can't > believe how fast it is. The c++ part creates an in-memory database and then > periodically writes an ascii file. At that point, I grab the file and to the > bulk insert. Although the insert only takes seconds, it could well happen > that more ascii files appear. So the directory may at any moment contain N > files, to be processed in sequence. The current plan is to grab the first > file, inhale it, move it to another directory, and repeat. > > The files are going to have names such as xxx_20081103_01.csv. And then 02 > and so on. > > I'm pondering how to know the next file to open. I suppose that if I read > the directory list sorted by name or date that will give me the earliest > file, and then I can just pass that name to the sproc that calls Bulk > Insert. But before I code it, I thought to ask you wizards if you can see > any holes in this approach. > > TIA, > Arthur > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > _________________________________________________________________ Get more out of the Web. Learn 10 hidden secrets of Windows Live. http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008 From fuller.artful at gmail.com Mon Oct 6 11:40:08 2008 From: fuller.artful at gmail.com (Arthur Fuller) Date: Mon, 6 Oct 2008 13:40:08 -0300 Subject: [dba-SQLServer] Really Interesting puzzle In-Reply-To: References: <29f585dd0810030746x70a9d7ah2f0301d44a9d2656@mail.gmail.com> <29f585dd0810031115r31c05582je82fec46c78cd988@mail.gmail.com> <29f585dd0810031309t7112fcdbvd4923a87f7e4dc12@mail.gmail.com> Message-ID: <29f585dd0810060940g45d0dc55tfee6055670ecda48@mail.gmail.com> Thanks for the idea Mark. At this point in the development we can invent whatever filenames we like. Currently we're using a naming scheme like xxx_##, where ## is a sequence, but your approach may have advantages. I have to ponder it. A. On Mon, Oct 6, 2008 at 12:02 PM, Mark A Matte wrote: > > Arthur, > > I have a system that generates letters and postcards...every night it > receives a text file for letters to be processed. The users process twice a > week...and it needs to be in order. I'm assuming the numbers in the example > you gave are a date. In the file I receive, the date is part of the file > name. My system nows what files contained what data and when processed...a > file should be generated every day...so by looking at the date part of the > name...the system always knows what file should be processed next. > > Not sure if it helps...just the approach I use. > > Thanks, > > Mark > > From ssharkins at gmail.com Mon Oct 6 17:44:38 2008 From: ssharkins at gmail.com (Susan Harkins) Date: Mon, 6 Oct 2008 18:44:38 -0400 Subject: [dba-SQLServer] Views Message-ID: <14c901c92805$1e433bc0$2f8601c7@SusanOne> Do views still share the same popularity in 2008? Susan H. From Darryl.Collins at coles.com.au Mon Oct 6 18:08:10 2008 From: Darryl.Collins at coles.com.au (Darryl Collins) Date: Tue, 7 Oct 2008 10:08:10 +1100 Subject: [dba-SQLServer] Views In-Reply-To: <14c901c92805$1e433bc0$2f8601c7@SusanOne> Message-ID: <57E6E6CA42105A48B977303A2CDC2720076DA2703E@WPEXCH22.retail.ad.cmltd.net.au> Susan, At the risk of sounding like a goose. Do you mean Version 2008 or Year 2008? (as in they were soooo 2006...) Personally I use views alot - but I am very new to SQL Server so I am not a good test bed... -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of Susan Harkins Sent: Tuesday, 7 October 2008 9:45 AM To: SQLList Subject: [dba-SQLServer] Views Do views still share the same popularity in 2008? Susan H. _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com This email and any attachments may contain privileged and confidential information and are intended for the named addressee only. If you have received this e-mail in error, please notify the sender and delete this e-mail immediately. Any confidentiality, privilege or copyright is not waived or lost because this e-mail has been sent to you in error. It is your responsibility to check this e-mail and any attachments for viruses. No warranty is made that this material is free from computer virus or any other defect or error. Any loss/damage incurred by using this material is not the sender's responsibility. The sender's entire liability will be limited to resupplying the material. From ssharkins at gmail.com Mon Oct 6 18:21:24 2008 From: ssharkins at gmail.com (Susan Harkins) Date: Mon, 6 Oct 2008 19:21:24 -0400 Subject: [dba-SQLServer] Views References: <57E6E6CA42105A48B977303A2CDC2720076DA2703E@WPEXCH22.retail.ad.cmltd.net.au> Message-ID: <14df01c9280a$475a6420$2f8601c7@SusanOne> LOL -- how ambiguous of me. Sorry! ;) Yes, version 2008. I don't have 2008, but I haven't read or heard about views being replaced by something better, although, I can't imagine how -- they are such a nifty, basic tool. Susan H. > Susan, > > At the risk of sounding like a goose. Do you mean Version 2008 or Year > 2008? (as in they were soooo 2006...) > > > Personally I use views alot - but I am very new to SQL Server so I am not > a good test bed... From fuller.artful at gmail.com Tue Oct 7 10:08:41 2008 From: fuller.artful at gmail.com (Arthur Fuller) Date: Tue, 7 Oct 2008 12:08:41 -0300 Subject: [dba-SQLServer] Views In-Reply-To: <14df01c9280a$475a6420$2f8601c7@SusanOne> References: <57E6E6CA42105A48B977303A2CDC2720076DA2703E@WPEXCH22.retail.ad.cmltd.net.au> <14df01c9280a$475a6420$2f8601c7@SusanOne> Message-ID: <29f585dd0810070808l22f6a30ex6a7d00a6e9a60edd@mail.gmail.com> Views haven't been replaced. They still exist, but it is important to understand what they are. Beneath the covers, views are simply macros with names. (In Access lingo, they are named queries.) They are not compiled or optimized in the same way as stored procedures or table udfs. So depending on your perspective, they are either smart or stupid. For example, when I was doing a lot of Access ADP development, I found views to be an excellent approach for master-detail forms because Access would automatically do the filtering of the detail part. But the problem with views is that they don't accept parameters, and in large databases this is a killer. The alternatives are stored procedures and/or table udfs, both of which accept parameters. With a view you get back the whole result set and then your FE has to filter it. With a sproc or table udf, you supply parameters and get back only the relevant rows. If you are dealing with several million rows of which only 100 are of interest, this difference is dramatic. In my current app, I have one table that is currently at 35M rows and it will be 50M next month, and is expected to grow at that rate. A view on such a table (not to mention its JOINs) is preposterous. You never want to see all the data, you only want a narrow slice. Imagine a scenario in which 20 users on a LAN want to look at some slice of this data. 35M rows get sent to each user, then filtered to the narrow slice on the client side. Using a sproc or table udf instead, and supplying parameters that define the slice, only the result set gets transmitted to the user. Add more users and the resulting time difference becomes increasingly dramatic. hth, Arthur On Mon, Oct 6, 2008 at 8:21 PM, Susan Harkins wrote: > LOL -- how ambiguous of me. Sorry! ;) > > Yes, version 2008. > > I don't have 2008, but I haven't read or heard about views being replaced > by > something better, although, I can't imagine how -- they are such a nifty, > basic tool. > > Susan H. > > > From nancy.lytle at gmail.com Tue Oct 7 10:42:00 2008 From: nancy.lytle at gmail.com (Nancy Lytle) Date: Tue, 7 Oct 2008 10:42:00 -0500 Subject: [dba-SQLServer] Views In-Reply-To: <29f585dd0810070808l22f6a30ex6a7d00a6e9a60edd@mail.gmail.com> References: <57E6E6CA42105A48B977303A2CDC2720076DA2703E@WPEXCH22.retail.ad.cmltd.net.au> <14df01c9280a$475a6420$2f8601c7@SusanOne> <29f585dd0810070808l22f6a30ex6a7d00a6e9a60edd@mail.gmail.com> Message-ID: On the other hand, many people will use a view to substitute for the table(s) against which the sproc or table udf is run. Nancy Lytle N_Lytle at terpalum.umd.edu EMAILING FOR THE GREATER GOODJoin me > Date: Tue, 7 Oct 2008 12:08:41 -0300> From: fuller.artful at gmail.com> To: dba-sqlserver at databaseadvisors.com> Subject: Re: [dba-SQLServer] Views> > Views haven't been replaced. They still exist, but it is important to> understand what they are. Beneath the covers, views are simply macros with> names. (In Access lingo, they are named queries.) They are not compiled or> optimized in the same way as stored procedures or table udfs. So depending> on your perspective, they are either smart or stupid.> > For example, when I was doing a lot of Access ADP development, I found views> to be an excellent approach for master-detail forms because Access would> automatically do the filtering of the detail part. But the problem with> views is that they don't accept parameters, and in large databases this is a> killer. The alternatives are stored procedures and/or table udfs, both of> which accept parameters.> > With a view you get back the whole result set and then your FE has to filter> it. With a sproc or table udf, you supply parameters and get back only the> relevant rows. If you are dealing with several million rows of which only> 100 are of interest, this difference is dramatic.> > In my current app, I have one table that is currently at 35M rows and it> will be 50M next month, and is expected to grow at that rate. A view on such> a table (not to mention its JOINs) is preposterous. You never want to see> all the data, you only want a narrow slice. Imagine a scenario in which 20> users on a LAN want to look at some slice of this data. 35M rows get sent to> each user, then filtered to the narrow slice on the client side. Using a> sproc or table udf instead, and supplying parameters that define the slice,> only the result set gets transmitted to the user. Add more users and the> resulting time difference becomes increasingly dramatic.> > hth,> Arthur> > On Mon, Oct 6, 2008 at 8:21 PM, Susan Harkins wrote:> > > LOL -- how ambiguous of me. Sorry! ;)> >> > Yes, version 2008.> >> > I don't have 2008, but I haven't read or heard about views being replaced> > by> > something better, although, I can't imagine how -- they are such a nifty,> > basic tool.> >> > Susan H.> >> >> >> _______________________________________________> 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 Tue Oct 7 12:45:14 2008 From: robert at webedb.com (Robert L. Stewart) Date: Tue, 07 Oct 2008 12:45:14 -0500 Subject: [dba-SQLServer] Views In-Reply-To: References: Message-ID: <200810071750.m97HopEj022209@databaseadvisors.com> Where I am at now, we are trying to get rid of all views. We are using stored procedures instead and using derived tables rather heavily. At 12:00 PM 10/7/2008, you wrote: >Date: Mon, 6 Oct 2008 18:44:38 -0400 >From: "Susan Harkins" >Subject: [dba-SQLServer] Views >To: "SQLList" >Message-ID: <14c901c92805$1e433bc0$2f8601c7 at SusanOne> >Content-Type: text/plain; format=flowed; charset="iso-8859-1"; > reply-type=original > >Do views still share the same popularity in 2008? > >Susan H. From David at sierranevada.com Tue Oct 7 13:09:45 2008 From: David at sierranevada.com (David Lewis) Date: Tue, 7 Oct 2008 11:09:45 -0700 Subject: [dba-SQLServer] dba-SQLServer Digest, Vol 68, Issue 7 In-Reply-To: References: Message-ID: With regard to: "With a view you get back the whole result set and then your FE has to filter it. With a sproc or table udf, you supply parameters and get back only the relevant rows. If you are dealing with several million rows of which only 100 are of interest, this difference is dramatic." There is of course nothing to prevent one from SELECT columnlist FROM vwXYZ WHERE parameters.... ---------------------------- Message: 4 Date: Tue, 7 Oct 2008 12:08:41 -0300 From: "Arthur Fuller" Subject: Re: [dba-SQLServer] Views To: "Discussion concerning MS SQL Server" Message-ID: <29f585dd0810070808l22f6a30ex6a7d00a6e9a60edd at mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Views haven't been replaced. They still exist, but it is important to understand what they are. Beneath the covers, views are simply macros with names. (In Access lingo, they are named queries.) They are not compiled or optimized in the same way as stored procedures or table udfs. So depending on your perspective, they are either smart or stupid. For example, when I was doing a lot of Access ADP development, I found views to be an excellent approach for master-detail forms because Access would automatically do the filtering of the detail part. But the problem with views is that they don't accept parameters, and in large databases this is a killer. The alternatives are stored procedures and/or table udfs, both of which accept parameters. With a view you get back the whole result set and then your FE has to filter it. With a sproc or table udf, you supply parameters and get back only the relevant rows. If you are dealing with several million rows of which only 100 are of interest, this difference is dramatic. In my current app, I have one table that is currently at 35M rows and it will be 50M next month, and is expected to grow at that rate. A view on such a table (not to mention its JOINs) is preposterous. You never want to see all the data, you only want a narrow slice. Imagine a scenario in which 20 users on a LAN want to look at some slice of this data. 35M rows get sent to each user, then filtered to the narrow slice on the client side. Using a sproc or table udf instead, and supplying parameters that define the slice, only the result set gets transmitted to the user. Add more users and the resulting time difference becomes increasingly dramatic. hth, Arthur On Mon, Oct 6, 2008 at 8:21 PM, Susan Harkins wrote: > LOL -- how ambiguous of me. Sorry! ;) > > Yes, version 2008. > > I don't have 2008, but I haven't read or heard about views being replaced > by > something better, although, I can't imagine how -- they are such a nifty, > basic tool. > > Susan H. > > > The contents of this e-mail message and its attachments are covered by the Electronic Communications Privacy Act (18 U.S.C. 2510-2521) and are intended solely for the addressee(s) hereof. If you are not the named recipient, or the employee or agent responsible for delivering the message to the intended recipient, or if this message has been addressed to you in error, you are directed not to read, disclose, reproduce, distribute, disseminate or otherwise use this transmission. If you have received this communication in error, please notify us immediately by return e-mail or by telephone, 530-893-3520, and delete and/or destroy all copies of the message immediately. From ssharkins at gmail.com Tue Oct 7 13:23:06 2008 From: ssharkins at gmail.com (Susan Harkins) Date: Tue, 7 Oct 2008 14:23:06 -0400 Subject: [dba-SQLServer] Views References: <200810071750.m97HopEj022209@databaseadvisors.com> Message-ID: <162e01c928a9$cd1f3b90$2f8601c7@SusanOne> Why? Susan H. > Where I am at now, we are trying to get rid of all views. > We are using stored procedures instead and using derived > tables rather heavily. From fuller.artful at gmail.com Tue Oct 7 15:00:23 2008 From: fuller.artful at gmail.com (Arthur Fuller) Date: Tue, 7 Oct 2008 17:00:23 -0300 Subject: [dba-SQLServer] Views In-Reply-To: <162e01c928a9$cd1f3b90$2f8601c7@SusanOne> References: <200810071750.m97HopEj022209@databaseadvisors.com> <162e01c928a9$cd1f3b90$2f8601c7@SusanOne> Message-ID: <29f585dd0810071300u1fd24e3bh7ff9642496e868d5@mail.gmail.com> Didn't I already answer that question, Susan? Views are a wonderful convenience if you have a smallish number of rows, but the overhead seriously adds up when you pass, say, 50K rows in a table -- let alone 50M rows. SELECT * FROM MyView WHERE PK = 124 results in the case of a view that all rows in the view are sent to the client and then the client filters the result set. By contrast, a sproc that accepts a @PK parameter will execute on the server and transmit only the result set over the pipe, This could be a difference of hundreds of thousands or even millions of rows. Multiply that by the number of users. Views are cute and fun, but essentially stupid. That said, I build them all the time, because I get to use the designer to build them, but then I save them and grab the SQL generated by the designer and turn it into a parameterized sproc or table udf. A. On Tue, Oct 7, 2008 at 3:23 PM, Susan Harkins wrote: > Why? > > Susan H. > > > From Elizabeth.J.Doering at wellsfargo.com Tue Oct 7 15:31:09 2008 From: Elizabeth.J.Doering at wellsfargo.com (Elizabeth.J.Doering at wellsfargo.com) Date: Tue, 7 Oct 2008 15:31:09 -0500 Subject: [dba-SQLServer] Views References: <200810071750.m97HopEj022209@databaseadvisors.com><162e01c928a9$cd1f3b90$2f8601c7@SusanOne> <29f585dd0810071300u1fd24e3bh7ff9642496e868d5@mail.gmail.com> Message-ID: Arthur, I'm not following you. I create a view, then use it in a stored procedure: CREATE PROCEDURE [dbo].[procMyStoredProcedure] @MyVariable int as Select Field1, Field2, Field3 from uvwMyView where Field5 = @MyVariable What am I losing? I'm still returning only the records where my condition is met. Thanks, Liz -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller Sent: Tuesday, October 07, 2008 3:00 PM To: Discussion concerning MS SQL Server Subject: Re: [dba-SQLServer] Views Didn't I already answer that question, Susan? Views are a wonderful convenience if you have a smallish number of rows, but the overhead seriously adds up when you pass, say, 50K rows in a table -- let alone 50M rows. SELECT * FROM MyView WHERE PK = 124 results in the case of a view that all rows in the view are sent to the client and then the client filters the result set. By contrast, a sproc that accepts a @PK parameter will execute on the server and transmit only the result set over the pipe, This could be a difference of hundreds of thousands or even millions of rows. Multiply that by the number of users. Views are cute and fun, but essentially stupid. That said, I build them all the time, because I get to use the designer to build them, but then I save them and grab the SQL generated by the designer and turn it into a parameterized sproc or table udf. A. On Tue, Oct 7, 2008 at 3:23 PM, Susan Harkins wrote: > Why? > > Susan H. > > > _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From stuart at lexacorp.com.pg Tue Oct 7 16:13:02 2008 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Wed, 08 Oct 2008 07:13:02 +1000 Subject: [dba-SQLServer] Views In-Reply-To: <29f585dd0810071300u1fd24e3bh7ff9642496e868d5@mail.gmail.com> References: , <162e01c928a9$cd1f3b90$2f8601c7@SusanOne>, <29f585dd0810071300u1fd24e3bh7ff9642496e868d5@mail.gmail.com> Message-ID: <48EC5D7E.31126.2CF00D3@stuart.lexacorp.com.pg> Isn't it simpler, but effectively the same once you have created the view to write your sproc as: SELECT * FROM MyView WHERE PK = @PK On 7 Oct 2008 at 17:00, Arthur Fuller wrote: > Didn't I already answer that question, Susan? Views are a wonderful > convenience if you have a smallish number of rows, but the overhead > seriously adds up when you pass, say, 50K rows in a table -- let alone 50M > rows. > > SELECT * FROM MyView WHERE PK = 124 > > results in the case of a view that all rows in the view are sent to the > client and then the client filters the result set. By contrast, a sproc that > accepts a @PK parameter will execute on the server and transmit only the > result set over the pipe, This could be a difference of hundreds of > thousands or even millions of rows. Multiply that by the number of users. > > Views are cute and fun, but essentially stupid. That said, I build them all > the time, because I get to use the designer to build them, but then I save > them and grab the SQL generated by the designer and turn it into a > parameterized sproc or table udf. > > A. > > On Tue, Oct 7, 2008 at 3:23 PM, Susan Harkins wrote: > > > Why? > > > > Susan H. > > > > > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > From Darryl.Collins at coles.com.au Tue Oct 7 18:48:18 2008 From: Darryl.Collins at coles.com.au (Darryl Collins) Date: Wed, 8 Oct 2008 10:48:18 +1100 Subject: [dba-SQLServer] Views In-Reply-To: <29f585dd0810070808l22f6a30ex6a7d00a6e9a60edd@mail.gmail.com> Message-ID: <57E6E6CA42105A48B977303A2CDC2720076DA2704D@WPEXCH22.retail.ad.cmltd.net.au> ok... now i am a bit confused. One way i use views is to create summary data tables (using grouped data) This normally compacts all the transactional level data into a tighter grouping (say department level for example). Then I use an ID to just pull in the data I need to the Access FE (usually in a form) for that specific grouping. SELECT * FROM vMySummaryView WHERE DeptID = @DeptID Are you saying that this will still pull ALL of the data into the Access FE? surely not? Although it sounds like creating the output of the view via a sproc will run much faster - I thought that the view (being already made) would be quick, but this "not compiled or optimized in the same way as stored procedures" bit has me thinking. The database I used will have 100,000's of rows of data rather than millions. And probably 40 or so users hitting it at any one time - not massive by any means. I read about "partitioned views" as well - again they are meant to be fast, but I have never tried it. Anyone else want to add more to this? cheers Darryl. -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of Arthur Fuller Sent: Wednesday, 8 October 2008 2:09 AM To: Discussion concerning MS SQL Server Subject: Re: [dba-SQLServer] Views Views haven't been replaced. They still exist, but it is important to understand what they are. Beneath the covers, views are simply macros with names. (In Access lingo, they are named queries.) They are not compiled or optimized in the same way as stored procedures or table udfs. So depending on your perspective, they are either smart or stupid. For example, when I was doing a lot of Access ADP development, I found views to be an excellent approach for master-detail forms because Access would automatically do the filtering of the detail part. But the problem with views is that they don't accept parameters, and in large databases this is a killer. The alternatives are stored procedures and/or table udfs, both of which accept parameters. With a view you get back the whole result set and then your FE has to filter it. With a sproc or table udf, you supply parameters and get back only the relevant rows. If you are dealing with several million rows of which only 100 are of interest, this difference is dramatic. In my current app, I have one table that is currently at 35M rows and it will be 50M next month, and is expected to grow at that rate. A view on such a table (not to mention its JOINs) is preposterous. You never want to see all the data, you only want a narrow slice. Imagine a scenario in which 20 users on a LAN want to look at some slice of this data. 35M rows get sent to each user, then filtered to the narrow slice on the client side. Using a sproc or table udf instead, and supplying parameters that define the slice, only the result set gets transmitted to the user. Add more users and the resulting time difference becomes increasingly dramatic. hth, Arthur On Mon, Oct 6, 2008 at 8:21 PM, Susan Harkins wrote: > LOL -- how ambiguous of me. Sorry! ;) > > Yes, version 2008. > > I don't have 2008, but I haven't read or heard about views being replaced > by > something better, although, I can't imagine how -- they are such a nifty, > basic tool. > > Susan H. > > > _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com This email and any attachments may contain privileged and confidential information and are intended for the named addressee only. If you have received this e-mail in error, please notify the sender and delete this e-mail immediately. Any confidentiality, privilege or copyright is not waived or lost because this e-mail has been sent to you in error. It is your responsibility to check this e-mail and any attachments for viruses. No warranty is made that this material is free from computer virus or any other defect or error. Any loss/damage incurred by using this material is not the sender's responsibility. The sender's entire liability will be limited to resupplying the material. From Gustav at cactus.dk Wed Oct 8 05:11:43 2008 From: Gustav at cactus.dk (Gustav Brock) Date: Wed, 08 Oct 2008 12:11:43 +0200 Subject: [dba-SQLServer] Views Message-ID: Hi Susan I use views to bring tables from linked databases (could be an mdb file) into the database where access is needed to isolate the name of the linked server and the not-so-easy syntax to attach this (the three dots): SELECT FROM LinkedDbName...OriginalTableName AS AliasTableName /gustav >From: "Susan Harkins" >Do views still share the same popularity in 2008? > >Susan H. From robert at webedb.com Wed Oct 8 07:00:55 2008 From: robert at webedb.com (Robert L. Stewart) Date: Wed, 08 Oct 2008 07:00:55 -0500 Subject: [dba-SQLServer] Views In-Reply-To: References: Message-ID: <200810081203.m98C2uch012341@databaseadvisors.com> One reason is performance. Another reason is if you recreate a database from scripts, you have to know the order for views. They cannot be created if they are based on another view that does not exist. Sprocs can be created even if there is a missing dependency on another sproc. They will also have trouble if they are based on a view and it does not exist yet when recreating it. The last reason is lack of parameters in a view. At 05:12 AM 10/8/2008, you wrote: >Date: Tue, 7 Oct 2008 14:23:06 -0400 >From: "Susan Harkins" >Subject: Re: [dba-SQLServer] Views >To: "Discussion concerning MS SQL Server" > >Message-ID: <162e01c928a9$cd1f3b90$2f8601c7 at SusanOne> >Content-Type: text/plain; format=flowed; charset="iso-8859-1"; > reply-type=original > >Why? > >Susan H. > > > > Where I am at now, we are trying to get rid of all views. > > We are using stored procedures instead and using derived > > tables rather heavily. From fhtapia at gmail.com Wed Oct 8 11:33:33 2008 From: fhtapia at gmail.com (Francisco Tapia) Date: Wed, 8 Oct 2008 09:33:33 -0700 Subject: [dba-SQLServer] Views In-Reply-To: <29f585dd0810070808l22f6a30ex6a7d00a6e9a60edd@mail.gmail.com> References: <57E6E6CA42105A48B977303A2CDC2720076DA2703E@WPEXCH22.retail.ad.cmltd.net.au> <14df01c9280a$475a6420$2f8601c7@SusanOne> <29f585dd0810070808l22f6a30ex6a7d00a6e9a60edd@mail.gmail.com> Message-ID: Not to start a holy war, but I don't see any issues with Views. Just like any tool in your toolbox, a view can be used efficiently and as inefficiently as a cursor. So why do I state this?... a view is simply a result set defined for user display (or application display). They carry a great advantage when a sproc is not necessary. Short lists are generally the typical behavior for most applications such as a web app with multiple drop down lists... in that situation you may/may not wish to use a view it depends on what data is needed... ie, if the contents of the drop down are dynamic, then a sproc is in order... however what if the results are static? then there is no need to build up a sproc, as both result in a quick result no matter what. In my environment there have been instances where a view was justified... it was designed to have a minimal amout of columns and the where clause was designed to be a slice of time and data, the problem with a view of this nature is that at some point the business will want to verify all the data and will need a different (VIEW) that has all the resultsets... depending on how you make the call from your client, you can just say select * from view where columna = criteria. additionally views have an added advantage that they can become indexed views and therefor be optimized. -Francisco http://sqlthis.blogspot.com | Tsql and More... On Tue, Oct 7, 2008 at 8:08 AM, Arthur Fuller wrote: > Views haven't been replaced. They still exist, but it is important to > understand what they are. Beneath the covers, views are simply macros with > names. (In Access lingo, they are named queries.) They are not compiled or > optimized in the same way as stored procedures or table udfs. So depending > on your perspective, they are either smart or stupid. > > For example, when I was doing a lot of Access ADP development, I found > views > to be an excellent approach for master-detail forms because Access would > automatically do the filtering of the detail part. But the problem with > views is that they don't accept parameters, and in large databases this is > a > killer. The alternatives are stored procedures and/or table udfs, both of > which accept parameters. > > With a view you get back the whole result set and then your FE has to > filter > it. With a sproc or table udf, you supply parameters and get back only the > relevant rows. If you are dealing with several million rows of which only > 100 are of interest, this difference is dramatic. > > In my current app, I have one table that is currently at 35M rows and it > will be 50M next month, and is expected to grow at that rate. A view on > such > a table (not to mention its JOINs) is preposterous. You never want to see > all the data, you only want a narrow slice. Imagine a scenario in which 20 > users on a LAN want to look at some slice of this data. 35M rows get sent > to > each user, then filtered to the narrow slice on the client side. Using a > sproc or table udf instead, and supplying parameters that define the slice, > only the result set gets transmitted to the user. Add more users and the > resulting time difference becomes increasingly dramatic. > > hth, > Arthur > > On Mon, Oct 6, 2008 at 8:21 PM, Susan Harkins wrote: > > > LOL -- how ambiguous of me. Sorry! ;) > > > > Yes, version 2008. > > > > I don't have 2008, but I haven't read or heard about views being replaced > > by > > something better, although, I can't imagine how -- they are such a nifty, > > basic tool. > > > > Susan H. > > > > > > > _______________________________________________ > 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 Wed Oct 8 11:37:53 2008 From: fhtapia at gmail.com (Francisco Tapia) Date: Wed, 8 Oct 2008 09:37:53 -0700 Subject: [dba-SQLServer] Question about the transaction log In-Reply-To: <29f585dd0810031012x2d9eefc5s1ce487d128de77a3@mail.gmail.com> References: <29f585dd0810031012x2d9eefc5s1ce487d128de77a3@mail.gmail.com> Message-ID: Yes, stuff is always written to the log.. one way to avoid this is to set your database recovery model to Simple, then the changes are actually made to the tempdb, one method that I use to control log growth is to setup a job that will truncate the log when it hits 60% of it's full size... I initially start a full backup before I tackle the index defrag that way I have a recovery point if I need one. :) -Francisco http://sqlthis.blogspot.com | Tsql and More... On Fri, Oct 3, 2008 at 10:12 AM, Arthur Fuller wrote: > Suppose that I issue an ALTER INDEX ALL REBUILD command. Does stuff get > written to the transaction log? If so, can I turn that off, and then turn > it > back on after I have rebuilt the indexes? > > I looked in Paul Nielsen's SQL Bible and found nothing relevant. Tried BOL > as well and nothing emerged. > > Arthur > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From ssharkins at gmail.com Wed Oct 8 12:03:30 2008 From: ssharkins at gmail.com (Susan Harkins) Date: Wed, 8 Oct 2008 13:03:30 -0400 Subject: [dba-SQLServer] Views References: <200810071750.m97HopEj022209@databaseadvisors.com><162e01c928a9$cd1f3b90$2f8601c7@SusanOne> <29f585dd0810071300u1fd24e3bh7ff9642496e868d5@mail.gmail.com> Message-ID: <1adc01c92967$cd3ff1a0$2f8601c7@SusanOne> > SELECT * FROM MyView WHERE PK = 124 > > results in the case of a view that all rows in the view are sent to the > client and then the client filters the result set. =======Arthur, I'm not sure I understand -- are you saying that if MyView contains 100 records but only 2 that satisfy the WHERE clause, the view still pulls all 100 records but only displays 2? Susan H. From fuller.artful at gmail.com Wed Oct 8 12:05:13 2008 From: fuller.artful at gmail.com (Arthur Fuller) Date: Wed, 8 Oct 2008 14:05:13 -0300 Subject: [dba-SQLServer] Views In-Reply-To: References: <57E6E6CA42105A48B977303A2CDC2720076DA2703E@WPEXCH22.retail.ad.cmltd.net.au> <14df01c9280a$475a6420$2f8601c7@SusanOne> <29f585dd0810070808l22f6a30ex6a7d00a6e9a60edd@mail.gmail.com> Message-ID: <29f585dd0810081005j6e3d111w7989607b3885ef20@mail.gmail.com> 100% agreement. A. From fuller.artful at gmail.com Wed Oct 8 12:15:00 2008 From: fuller.artful at gmail.com (Arthur Fuller) Date: Wed, 8 Oct 2008 14:15:00 -0300 Subject: [dba-SQLServer] Views In-Reply-To: <1adc01c92967$cd3ff1a0$2f8601c7@SusanOne> References: <200810071750.m97HopEj022209@databaseadvisors.com> <162e01c928a9$cd1f3b90$2f8601c7@SusanOne> <29f585dd0810071300u1fd24e3bh7ff9642496e868d5@mail.gmail.com> <1adc01c92967$cd3ff1a0$2f8601c7@SusanOne> Message-ID: <29f585dd0810081015o6cd085y158f682240a8c632@mail.gmail.com> That is my understanding of the documentation, Susan. The view pulls everything to the client, which then filters out everything not interesting. I could be wrong about this but it would be relatively easy to generate a test. Unfortunately, today I have lots of work on my plate, but by tomorrow I will have a 50M row table on which to test this hypothesis. A. On Wed, Oct 8, 2008 at 2:03 PM, Susan Harkins wrote: > > SELECT * FROM MyView WHERE PK = 124 > > > > results in the case of a view that all rows in the view are sent to the > > client and then the client filters the result set. > > =======Arthur, I'm not sure I understand -- are you saying that if MyView > contains 100 records but only 2 that satisfy the WHERE clause, the view > still pulls all 100 records but only displays 2? > > Susan H. > From ssharkins at gmail.com Wed Oct 8 12:24:52 2008 From: ssharkins at gmail.com (Susan Harkins) Date: Wed, 8 Oct 2008 13:24:52 -0400 Subject: [dba-SQLServer] Views References: <200810071750.m97HopEj022209@databaseadvisors.com><162e01c928a9$cd1f3b90$2f8601c7@SusanOne><29f585dd0810071300u1fd24e3bh7ff9642496e868d5@mail.gmail.com><1adc01c92967$cd3ff1a0$2f8601c7@SusanOne> <29f585dd0810081015o6cd085y158f682240a8c632@mail.gmail.com> Message-ID: <1af101c9296a$ceba2e30$2f8601c7@SusanOne> > That is my understanding of the documentation, Susan. The view pulls > everything to the client, which then filters out everything not > interesting. > I could be wrong about this but it would be relatively easy to generate a > test. Unfortunately, today I have lots of work on my plate, but by > tomorrow > I will have a 50M row table on which to test this hypothesis. ========How would you test it? I can test it, but I'm sitting here wondering how???? Susan H. From mwp.reid at qub.ac.uk Wed Oct 8 12:30:38 2008 From: mwp.reid at qub.ac.uk (Martin Reid) Date: Wed, 8 Oct 2008 18:30:38 +0100 Subject: [dba-SQLServer] Views In-Reply-To: <1af101c9296a$ceba2e30$2f8601c7@SusanOne> References: <200810071750.m97HopEj022209@databaseadvisors.com><162e01c928a9$cd1f3b90$2f8601c7@SusanOne><29f585dd0810071300u1fd24e3bh7ff9642496e868d5@mail.gmail.com><1adc01c92967$cd3ff1a0$2f8601c7@SusanOne> <29f585dd0810081015o6cd085y158f682240a8c632@mail.gmail.com>, <1af101c9296a$ceba2e30$2f8601c7@SusanOne> Message-ID: Susan Might help http://www.eggheadcafe.com/software/aspnet/32330849/how-does-access-talk-to.aspx Martin Martin WP Reid Information Services Queen's University Riddel Hall 185 Stranmillis Road Belfast BT9 5EE Tel : 02890974465 Email : mwp.reid at qub.ac.uk ________________________________________ From: dba-sqlserver-bounces at databaseadvisors.com [dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Susan Harkins [ssharkins at gmail.com] Sent: 08 October 2008 18:24 To: Discussion concerning MS SQL Server Subject: Re: [dba-SQLServer] Views > That is my understanding of the documentation, Susan. The view pulls > everything to the client, which then filters out everything not > interesting. > I could be wrong about this but it would be relatively easy to generate a > test. Unfortunately, today I have lots of work on my plate, but by > tomorrow > I will have a 50M row table on which to test this hypothesis. ========How would you test it? I can test it, but I'm sitting here wondering how???? Susan H. _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From ssharkins at gmail.com Wed Oct 8 12:47:15 2008 From: ssharkins at gmail.com (Susan Harkins) Date: Wed, 8 Oct 2008 13:47:15 -0400 Subject: [dba-SQLServer] Views References: <200810071750.m97HopEj022209@databaseadvisors.com><162e01c928a9$cd1f3b90$2f8601c7@SusanOne><29f585dd0810071300u1fd24e3bh7ff9642496e868d5@mail.gmail.com><1adc01c92967$cd3ff1a0$2f8601c7@SusanOne><29f585dd0810081015o6cd085y158f682240a8c632@mail.gmail.com>, <1af101c9296a$ceba2e30$2f8601c7@SusanOne> Message-ID: <1b1401c9296d$ea815b90$2f8601c7@SusanOne> That's a discussion of Jet -- if there's something in there about SQL Server views, I didn't see it -- what did I miss? Susan H. > Susan > > Might help > > http://www.eggheadcafe.com/software/aspnet/32330849/how-does-access-talk-to.aspx > > Martin > > > Martin WP Reid > Information Services > Queen's University > Riddel Hall > 185 Stranmillis Road > Belfast > BT9 5EE > Tel : 02890974465 > Email : mwp.reid at qub.ac.uk > ________________________________________ > From: dba-sqlserver-bounces at databaseadvisors.com > [dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Susan Harkins > [ssharkins at gmail.com] > Sent: 08 October 2008 18:24 > To: Discussion concerning MS SQL Server > Subject: Re: [dba-SQLServer] Views > >> That is my understanding of the documentation, Susan. The view pulls >> everything to the client, which then filters out everything not >> interesting. >> I could be wrong about this but it would be relatively easy to generate a >> test. Unfortunately, today I have lots of work on my plate, but by >> tomorrow >> I will have a 50M row table on which to test this hypothesis. > > ========How would you test it? I can test it, but I'm sitting here > wondering > how???? > > Susan H. > > _______________________________________________ > 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 Wed Oct 8 12:53:00 2008 From: mwp.reid at qub.ac.uk (Martin Reid) Date: Wed, 8 Oct 2008 18:53:00 +0100 Subject: [dba-SQLServer] Views In-Reply-To: <1b1401c9296d$ea815b90$2f8601c7@SusanOne> References: <200810071750.m97HopEj022209@databaseadvisors.com><162e01c928a9$cd1f3b90$2f8601c7@SusanOne><29f585dd0810071300u1fd24e3bh7ff9642496e868d5@mail.gmail.com><1adc01c92967$cd3ff1a0$2f8601c7@SusanOne><29f585dd0810081015o6cd085y158f682240a8c632@mail.gmail.com>, <1af101c9296a$ceba2e30$2f8601c7@SusanOne> , <1b1401c9296d$ea815b90$2f8601c7@SusanOne> Message-ID: Getting old my eyes aint what they used to be Sorry Martin Martin WP Reid Information Services Queen's University Riddel Hall 185 Stranmillis Road Belfast BT9 5EE Tel : 02890974465 Email : mwp.reid at qub.ac.uk ________________________________________ From: dba-sqlserver-bounces at databaseadvisors.com [dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Susan Harkins [ssharkins at gmail.com] Sent: 08 October 2008 18:47 To: Discussion concerning MS SQL Server Subject: Re: [dba-SQLServer] Views That's a discussion of Jet -- if there's something in there about SQL Server views, I didn't see it -- what did I miss? Susan H. > Susan > > Might help > > http://www.eggheadcafe.com/software/aspnet/32330849/how-does-access-talk-to.aspx > > Martin > > > Martin WP Reid > Information Services > Queen's University > Riddel Hall > 185 Stranmillis Road > Belfast > BT9 5EE > Tel : 02890974465 > Email : mwp.reid at qub.ac.uk > ________________________________________ > From: dba-sqlserver-bounces at databaseadvisors.com > [dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Susan Harkins > [ssharkins at gmail.com] > Sent: 08 October 2008 18:24 > To: Discussion concerning MS SQL Server > Subject: Re: [dba-SQLServer] Views > >> That is my understanding of the documentation, Susan. The view pulls >> everything to the client, which then filters out everything not >> interesting. >> I could be wrong about this but it would be relatively easy to generate a >> test. Unfortunately, today I have lots of work on my plate, but by >> tomorrow >> I will have a 50M row table on which to test this hypothesis. > > ========How would you test it? I can test it, but I'm sitting here > wondering > how???? > > Susan H. > > _______________________________________________ > 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 ssharkins at gmail.com Wed Oct 8 13:00:07 2008 From: ssharkins at gmail.com (Susan Harkins) Date: Wed, 8 Oct 2008 14:00:07 -0400 Subject: [dba-SQLServer] Views References: <200810071750.m97HopEj022209@databaseadvisors.com><162e01c928a9$cd1f3b90$2f8601c7@SusanOne><29f585dd0810071300u1fd24e3bh7ff9642496e868d5@mail.gmail.com><1adc01c92967$cd3ff1a0$2f8601c7@SusanOne><29f585dd0810081015o6cd085y158f682240a8c632@mail.gmail.com>, <1af101c9296a$ceba2e30$2f8601c7@SusanOne>, <1b1401c9296d$ea815b90$2f8601c7@SusanOne> Message-ID: <1b3101c9296f$c61a97b0$2f8601c7@SusanOne> At least it's just your eyes! ;) Susan H. > Getting old my eyes aint what they used to be > From fuller.artful at gmail.com Wed Oct 8 13:00:52 2008 From: fuller.artful at gmail.com (Arthur Fuller) Date: Wed, 8 Oct 2008 15:00:52 -0300 Subject: [dba-SQLServer] Views In-Reply-To: References: <200810071750.m97HopEj022209@databaseadvisors.com> <162e01c928a9$cd1f3b90$2f8601c7@SusanOne> <29f585dd0810071300u1fd24e3bh7ff9642496e868d5@mail.gmail.com> <1adc01c92967$cd3ff1a0$2f8601c7@SusanOne> <29f585dd0810081015o6cd085y158f682240a8c632@mail.gmail.com> <1af101c9296a$ceba2e30$2f8601c7@SusanOne> <1b1401c9296d$ea815b90$2f8601c7@SusanOne> Message-ID: <29f585dd0810081100m782d7a2s653c234a8e4f6eb0@mail.gmail.com> Memory is the second thing to go. I forget what the first thing was. What was your name again? On Wed, Oct 8, 2008 at 2:53 PM, Martin Reid wrote: > Getting old my eyes aint what they used to be > > Sorry > > Martin > From mwp.reid at qub.ac.uk Wed Oct 8 13:19:47 2008 From: mwp.reid at qub.ac.uk (Martin Reid) Date: Wed, 8 Oct 2008 19:19:47 +0100 Subject: [dba-SQLServer] Views In-Reply-To: <29f585dd0810081100m782d7a2s653c234a8e4f6eb0@mail.gmail.com> References: <200810071750.m97HopEj022209@databaseadvisors.com> <162e01c928a9$cd1f3b90$2f8601c7@SusanOne> <29f585dd0810071300u1fd24e3bh7ff9642496e868d5@mail.gmail.com> <1adc01c92967$cd3ff1a0$2f8601c7@SusanOne> <29f585dd0810081015o6cd085y158f682240a8c632@mail.gmail.com> <1af101c9296a$ceba2e30$2f8601c7@SusanOne> <1b1401c9296d$ea815b90$2f8601c7@SusanOne> , <29f585dd0810081100m782d7a2s653c234a8e4f6eb0@mail.gmail.com> Message-ID: (<: Feel like that myself sometimes arthur Martin Martin WP Reid Information Services Queen's University Riddel Hall 185 Stranmillis Road Belfast BT9 5EE Tel : 02890974465 Email : mwp.reid at qub.ac.uk ________________________________________ From: dba-sqlserver-bounces at databaseadvisors.com [dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller [fuller.artful at gmail.com] Sent: 08 October 2008 19:00 To: Discussion concerning MS SQL Server Subject: Re: [dba-SQLServer] Views Memory is the second thing to go. I forget what the first thing was. What was your name again? On Wed, Oct 8, 2008 at 2:53 PM, Martin Reid wrote: > Getting old my eyes aint what they used to be > > Sorry > > Martin > _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From gustav at cactus.dk Wed Oct 8 13:47:29 2008 From: gustav at cactus.dk (Gustav Brock) Date: Wed, 08 Oct 2008 20:47:29 +0200 Subject: [dba-SQLServer] Views Message-ID: Hi Martin Lots of chit-chat in that thread from people missing true knowledge about JET, thus only guessing or assuming. But, hey, Jim Dettman cannot be all over. /gustav >>> mwp.reid at qub.ac.uk 08-10-2008 19:30 >>> Susan Might help http://www.eggheadcafe.com/software/aspnet/32330849/how-does-access-talk-to.aspx Martin Martin WP Reid Information Services Queen's University Riddel Hall 185 Stranmillis Road Belfast BT9 5EE Tel : 02890974465 Email : mwp.reid at qub.ac.uk ________________________________________ From: dba-sqlserver-bounces at databaseadvisors.com [dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Susan Harkins [ssharkins at gmail.com] Sent: 08 October 2008 18:24 To: Discussion concerning MS SQL Server Subject: Re: [dba-SQLServer] Views > That is my understanding of the documentation, Susan. The view pulls > everything to the client, which then filters out everything not > interesting. > I could be wrong about this but it would be relatively easy to generate a > test. Unfortunately, today I have lots of work on my plate, but by > tomorrow > I will have a 50M row table on which to test this hypothesis. ========How would you test it? I can test it, but I'm sitting here wondering how???? Susan H. From ssharkins at gmail.com Wed Oct 8 13:50:43 2008 From: ssharkins at gmail.com (Susan Harkins) Date: Wed, 8 Oct 2008 14:50:43 -0400 Subject: [dba-SQLServer] Views References: <200810071750.m97HopEj022209@databaseadvisors.com><162e01c928a9$cd1f3b90$2f8601c7@SusanOne><29f585dd0810071300u1fd24e3bh7ff9642496e868d5@mail.gmail.com><1adc01c92967$cd3ff1a0$2f8601c7@SusanOne> <29f585dd0810081015o6cd085y158f682240a8c632@mail.gmail.com> Message-ID: <1b7b01c92976$c702f7b0$2f8601c7@SusanOne> Any help on this one? Anybody? How do you count the number of rows pulled by the view? Count()'s going to return the number displayed -- how can I count the underlying number to determine if it's the same? I'm at a total loss on that one. Susan H. > That is my understanding of the documentation, Susan. The view pulls > everything to the client, which then filters out everything not > interesting. > I could be wrong about this but it would be relatively easy to generate a > test. Unfortunately, today I have lots of work on my plate, but by > tomorrow > I will have a 50M row table on which to test this hypothesis. From James at fcidms.com Wed Oct 8 14:04:21 2008 From: James at fcidms.com (James Barash) Date: Wed, 8 Oct 2008 15:04:21 -0400 Subject: [dba-SQLServer] Views In-Reply-To: <29f585dd0810081015o6cd085y158f682240a8c632@mail.gmail.com> Message-ID: <010401c92978$ac520300$680101c0@fci.local> Sorry to jump in in the middle but I have done some testing using Selects from Views with Where clauses using pass-though queries in Access and, at least in that case, the filtering is done on the SQL Server and only the results are passed back to the client. The problem is you need to modify the SQL of the query to change the where clause. The way I tested this was to run the SQL Profiler on the Server and then open the query in Access. That way you can see exactly what the SQL Server is executing. I use Access to run reports against SQL Server and found this works pretty well. I also use stored procedures the same way if I need more complicated queries or need to manipulate the data for the reports. James Barash -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller Sent: Wednesday, October 08, 2008 1:15 PM To: Discussion concerning MS SQL Server Subject: Re: [dba-SQLServer] Views That is my understanding of the documentation, Susan. The view pulls everything to the client, which then filters out everything not interesting. I could be wrong about this but it would be relatively easy to generate a test. Unfortunately, today I have lots of work on my plate, but by tomorrow I will have a 50M row table on which to test this hypothesis. A. On Wed, Oct 8, 2008 at 2:03 PM, Susan Harkins wrote: > > SELECT * FROM MyView WHERE PK = 124 > > > > results in the case of a view that all rows in the view are sent to the > > client and then the client filters the result set. > > =======Arthur, I'm not sure I understand -- are you saying that if MyView > contains 100 records but only 2 that satisfy the WHERE clause, the view > still pulls all 100 records but only displays 2? > > Susan H. > _______________________________________________ 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 Wed Oct 8 14:44:53 2008 From: mwp.reid at qub.ac.uk (Martin Reid) Date: Wed, 8 Oct 2008 20:44:53 +0100 Subject: [dba-SQLServer] Views In-Reply-To: <010401c92978$ac520300$680101c0@fci.local> References: <29f585dd0810081015o6cd085y158f682240a8c632@mail.gmail.com>, <010401c92978$ac520300$680101c0@fci.local> Message-ID: Susan This gives you a good idea of what Access does http://msdn.microsoft.com/en-us/library/bb188204.aspx Martin Martin WP Reid Information Services Queen's University Riddel Hall 185 Stranmillis Road Belfast BT9 5EE Tel : 02890974465 Email : mwp.reid at qub.ac.uk ________________________________________ From: dba-sqlserver-bounces at databaseadvisors.com [dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of James Barash [James at fcidms.com] Sent: 08 October 2008 20:04 To: 'Discussion concerning MS SQL Server' Subject: Re: [dba-SQLServer] Views Sorry to jump in in the middle but I have done some testing using Selects from Views with Where clauses using pass-though queries in Access and, at least in that case, the filtering is done on the SQL Server and only the results are passed back to the client. The problem is you need to modify the SQL of the query to change the where clause. The way I tested this was to run the SQL Profiler on the Server and then open the query in Access. That way you can see exactly what the SQL Server is executing. I use Access to run reports against SQL Server and found this works pretty well. I also use stored procedures the same way if I need more complicated queries or need to manipulate the data for the reports. James Barash -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller Sent: Wednesday, October 08, 2008 1:15 PM To: Discussion concerning MS SQL Server Subject: Re: [dba-SQLServer] Views That is my understanding of the documentation, Susan. The view pulls everything to the client, which then filters out everything not interesting. I could be wrong about this but it would be relatively easy to generate a test. Unfortunately, today I have lots of work on my plate, but by tomorrow I will have a 50M row table on which to test this hypothesis. A. On Wed, Oct 8, 2008 at 2:03 PM, Susan Harkins wrote: > > SELECT * FROM MyView WHERE PK = 124 > > > > results in the case of a view that all rows in the view are sent to the > > client and then the client filters the result set. > > =======Arthur, I'm not sure I understand -- are you saying that if MyView > contains 100 records but only 2 that satisfy the WHERE clause, the view > still pulls all 100 records but only displays 2? > > Susan H. > _______________________________________________ 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 ssharkins at gmail.com Wed Oct 8 14:53:27 2008 From: ssharkins at gmail.com (Susan Harkins) Date: Wed, 8 Oct 2008 15:53:27 -0400 Subject: [dba-SQLServer] Views References: <29f585dd0810081015o6cd085y158f682240a8c632@mail.gmail.com>, <010401c92978$ac520300$680101c0@fci.local> Message-ID: <1c2301c9297f$99bd1160$2f8601c7@SusanOne> Um... thank you... but I want to know what SQL Server does. :) Susan H. > Susan > > This gives you a good idea of what Access does > > http://msdn.microsoft.com/en-us/library/bb188204.aspx > > Martin > > > Martin WP Reid > Information Services > Queen's University > Riddel Hall > 185 Stranmillis Road > Belfast > BT9 5EE > Tel : 02890974465 > Email : mwp.reid at qub.ac.uk > ________________________________________ > From: dba-sqlserver-bounces at databaseadvisors.com > [dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of James Barash > [James at fcidms.com] > Sent: 08 October 2008 20:04 > To: 'Discussion concerning MS SQL Server' > Subject: Re: [dba-SQLServer] Views > > Sorry to jump in in the middle but I have done some testing using Selects > from Views with Where clauses using pass-though queries in Access and, at > least in that case, the filtering is done on the SQL Server and only the > results are passed back to the client. The problem is you need to modify > the > SQL of the query to change the where clause. > The way I tested this was to run the SQL Profiler on the Server and then > open the query in Access. That way you can see exactly what the SQL Server > is executing. > I use Access to run reports against SQL Server and found this works pretty > well. I also use stored procedures the same way if I need more complicated > queries or need to manipulate the data for the reports. > > James Barash > > > -----Original Message----- > From: dba-sqlserver-bounces at databaseadvisors.com > [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Arthur > Fuller > Sent: Wednesday, October 08, 2008 1:15 PM > To: Discussion concerning MS SQL Server > Subject: Re: [dba-SQLServer] Views > > That is my understanding of the documentation, Susan. The view pulls > everything to the client, which then filters out everything not > interesting. > I could be wrong about this but it would be relatively easy to generate a > test. Unfortunately, today I have lots of work on my plate, but by > tomorrow > I will have a 50M row table on which to test this hypothesis. > > A. > > On Wed, Oct 8, 2008 at 2:03 PM, Susan Harkins wrote: > >> > SELECT * FROM MyView WHERE PK = 124 >> > >> > results in the case of a view that all rows in the view are sent to the >> > client and then the client filters the result set. >> >> =======Arthur, I'm not sure I understand -- are you saying that if MyView >> contains 100 records but only 2 that satisfy the WHERE clause, the view >> still pulls all 100 records but only displays 2? >> >> Susan H. >> > _______________________________________________ > 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 mwp.reid at qub.ac.uk Wed Oct 8 15:14:50 2008 From: mwp.reid at qub.ac.uk (Martin Reid) Date: Wed, 8 Oct 2008 21:14:50 +0100 Subject: [dba-SQLServer] Views In-Reply-To: <1c2301c9297f$99bd1160$2f8601c7@SusanOne> References: <29f585dd0810081015o6cd085y158f682240a8c632@mail.gmail.com>, <010401c92978$ac520300$680101c0@fci.local> , <1c2301c9297f$99bd1160$2f8601c7@SusanOne> Message-ID: >From that article Access sends SELECT * FROM Supplier SQL Server does SQLExecDirect: SELECT "dbo"."Shippers"."ShipperID" FROM "dbo"."Shippers" SQLPrepare: SELECT "ShipperID","CompanyName","Phone" FROM "dbo"."Shippers" WHERE "ShipperID" = ? OR "ShipperID" = ? OR "ShipperID" = ? OR "ShipperID" = ? OR "ShipperID" = ? OR "ShipperID" = ? OR "ShipperID" = ? OR "ShipperID" = ? OR "ShipperID" = ? OR "ShipperID" = ? SQLExecute: (MULTI-ROW FETCH) What you need to do is to run the SQL Server Profile while executing some statements to SQL Server form Access. This will show you whats happening. See this one http://articles.techrepublic.com.com/5100-10878_11-5054787.html You might know the authors. VBG Its important to understand as well what Access does and dosnt do. This relates to SQL Server 2000 I assume its still the same. When data is queried remotely in Access, all of the data is returned to the client, and any filtering and sorting is done on the client side. Because SQL Server data is usually queried over a network from a client, major network bandwidth issues can occur. Therefore, when moving your back end to SQL Server, it is important to redesign your queries so as to return only the required set of data to the client (rather than the whole data set). For example, a query behind an Access form would be: Martin Martin WP Reid Information Services Queen's University Riddel Hall 185 Stranmillis Road Belfast BT9 5EE Tel : 02890974465 Email : mwp.reid at qub.ac.uk From ssharkins at gmail.com Wed Oct 8 15:24:41 2008 From: ssharkins at gmail.com (Susan Harkins) Date: Wed, 8 Oct 2008 16:24:41 -0400 Subject: [dba-SQLServer] Views References: <29f585dd0810081015o6cd085y158f682240a8c632@mail.gmail.com>, <010401c92978$ac520300$680101c0@fci.local>, <1c2301c9297f$99bd1160$2f8601c7@SusanOne> Message-ID: <1c6501c92983$f421a4f0$2f8601c7@SusanOne> I'm totally missing your point I guess -- I'm working with views in SQL Server, Access has nothing to do with what I'm doing. But... I'll drag out Profiler and see what it says. :) Susan H. > > When data is queried remotely in Access, all of the data is returned to > the client, and any filtering and sorting is done on the client side. > Because SQL Server data is usually queried over a network from a client, > major network bandwidth issues can occur. Therefore, when moving your back > end to SQL Server, it is important to redesign your queries so as to > return only the required set of data to the client (rather than the whole > data set). For example, a query behind an Access form would be: From mwp.reid at qub.ac.uk Wed Oct 8 16:39:25 2008 From: mwp.reid at qub.ac.uk (Martin Reid) Date: Wed, 8 Oct 2008 22:39:25 +0100 Subject: [dba-SQLServer] Views In-Reply-To: <1c6501c92983$f421a4f0$2f8601c7@SusanOne> References: <29f585dd0810081015o6cd085y158f682240a8c632@mail.gmail.com>, <010401c92978$ac520300$680101c0@fci.local>, <1c2301c9297f$99bd1160$2f8601c7@SusanOne> , <1c6501c92983$f421a4f0$2f8601c7@SusanOne> Message-ID: Susan Sorry I read you where looking at performance of Views with Access. Its old age and to much SharePoint. Martin Martin WP Reid Information Services Queen's University Riddel Hall 185 Stranmillis Road Belfast BT9 5EE Tel : 02890974465 Email : mwp.reid at qub.ac.uk ________________________________________ From: dba-sqlserver-bounces at databaseadvisors.com [dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Susan Harkins [ssharkins at gmail.com] Sent: 08 October 2008 21:24 To: Discussion concerning MS SQL Server Subject: Re: [dba-SQLServer] Views I'm totally missing your point I guess -- I'm working with views in SQL Server, Access has nothing to do with what I'm doing. But... I'll drag out Profiler and see what it says. :) Susan H. > > When data is queried remotely in Access, all of the data is returned to > the client, and any filtering and sorting is done on the client side. > Because SQL Server data is usually queried over a network from a client, > major network bandwidth issues can occur. Therefore, when moving your back > end to SQL Server, it is important to redesign your queries so as to > return only the required set of data to the client (rather than the whole > data set). For example, a query behind an Access form would be: _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From newsgrps at dalyn.co.nz Wed Oct 8 17:07:23 2008 From: newsgrps at dalyn.co.nz (David Emerson) Date: Thu, 09 Oct 2008 11:07:23 +1300 Subject: [dba-SQLServer] Views In-Reply-To: References: <29f585dd0810081015o6cd085y158f682240a8c632@mail.gmail.com> <010401c92978$ac520300$680101c0@fci.local> <1c2301c9297f$99bd1160$2f8601c7@SusanOne> <1c6501c92983$f421a4f0$2f8601c7@SusanOne> Message-ID: <20081008220458.SZVI1303.mta04.xtra.co.nz@Dalyn.dalyn.co.nz> Never mind Martin, I have found your links useful as I have a client that we are converting to an SQL BE and I am working out whether to use an Access ADP, or mdb with ODBC links. Regards David Emerson Dalyn Software Ltd Wellington, New Zealand At 9/10/2008, you wrote: >Susan > >Sorry I read you where looking at performance of Views with Access. >Its old age and to much SharePoint. > >Martin > > >Martin WP Reid >Information Services >Queen's University >Riddel Hall >185 Stranmillis Road >Belfast >BT9 5EE >Tel : 02890974465 >Email : mwp.reid at qub.ac.uk >________________________________________ >From: dba-sqlserver-bounces at databaseadvisors.com >[dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Susan >Harkins [ssharkins at gmail.com] >Sent: 08 October 2008 21:24 >To: Discussion concerning MS SQL Server >Subject: Re: [dba-SQLServer] Views > >I'm totally missing your point I guess -- I'm working with views in SQL >Server, Access has nothing to do with what I'm doing. > >But... I'll drag out Profiler and see what it says. :) > >Susan H. > > > > > > > When data is queried remotely in Access, all of the data is returned to > > the client, and any filtering and sorting is done on the client side. > > Because SQL Server data is usually queried over a network from a client, > > major network bandwidth issues can occur. Therefore, when moving your back > > end to SQL Server, it is important to redesign your queries so as to > > return only the required set of data to the client (rather than the whole > > data set). For example, a query behind an Access form would be: > >_______________________________________________ >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 Darryl.Collins at coles.com.au Wed Oct 8 17:19:06 2008 From: Darryl.Collins at coles.com.au (Darryl Collins) Date: Thu, 9 Oct 2008 09:19:06 +1100 Subject: [dba-SQLServer] Views In-Reply-To: <29f585dd0810081015o6cd085y158f682240a8c632@mail.gmail.com> Message-ID: <57E6E6CA42105A48B977303A2CDC2720076DA27055@WPEXCH22.retail.ad.cmltd.net.au> wow... I would be really interested to read your results on this Arthur. Thanks for doing all this poking around on behalf of the list. -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of Arthur Fuller Sent: Thursday, 9 October 2008 4:15 AM To: Discussion concerning MS SQL Server Subject: Re: [dba-SQLServer] Views That is my understanding of the documentation, Susan. The view pulls everything to the client, which then filters out everything not interesting. I could be wrong about this but it would be relatively easy to generate a test. Unfortunately, today I have lots of work on my plate, but by tomorrow I will have a 50M row table on which to test this hypothesis. A. On Wed, Oct 8, 2008 at 2:03 PM, Susan Harkins wrote: > > SELECT * FROM MyView WHERE PK = 124 > > > > results in the case of a view that all rows in the view are sent to the > > client and then the client filters the result set. > > =======Arthur, I'm not sure I understand -- are you saying that if MyView > contains 100 records but only 2 that satisfy the WHERE clause, the view > still pulls all 100 records but only displays 2? > > Susan H. > _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com This email and any attachments may contain privileged and confidential information and are intended for the named addressee only. If you have received this e-mail in error, please notify the sender and delete this e-mail immediately. Any confidentiality, privilege or copyright is not waived or lost because this e-mail has been sent to you in error. It is your responsibility to check this e-mail and any attachments for viruses. No warranty is made that this material is free from computer virus or any other defect or error. Any loss/damage incurred by using this material is not the sender's responsibility. The sender's entire liability will be limited to resupplying the material. From ssharkins at gmail.com Wed Oct 8 17:39:43 2008 From: ssharkins at gmail.com (Susan Harkins) Date: Wed, 8 Oct 2008 18:39:43 -0400 Subject: [dba-SQLServer] Views References: <29f585dd0810081015o6cd085y158f682240a8c632@mail.gmail.com>, <010401c92978$ac520300$680101c0@fci.local>, <1c2301c9297f$99bd1160$2f8601c7@SusanOne>, <1c6501c92983$f421a4f0$2f8601c7@SusanOne> Message-ID: <1d1101c92996$c6babd90$2f8601c7@SusanOne> I think that's probably a normal assumption when you're talking to me Martin, but this time, it's just SQL Server. :) Susan H. > Susan > > Sorry I read you where looking at performance of Views with Access. Its > old age and to much SharePoint. From ssharkins at gmail.com Thu Oct 9 07:52:57 2008 From: ssharkins at gmail.com (Susan Harkins) Date: Thu, 9 Oct 2008 08:52:57 -0400 Subject: [dba-SQLServer] Views References: <200810071750.m97HopEj022209@databaseadvisors.com><162e01c928a9$cd1f3b90$2f8601c7@SusanOne><29f585dd0810071300u1fd24e3bh7ff9642496e868d5@mail.gmail.com><1adc01c92967$cd3ff1a0$2f8601c7@SusanOne> <29f585dd0810081015o6cd085y158f682240a8c632@mail.gmail.com> Message-ID: <1eb701c92a0d$f5fe3970$2f8601c7@SusanOne> Okay Arthur, I went to the big guy -- Mike Gunderloy: "Views are materialized on the server. The client only gets the matching data." I win!!! ;) Susan H. > That is my understanding of the documentation, Susan. The view pulls > everything to the client, which then filters out everything not > interesting. > I could be wrong about this but it would be relatively easy to generate a > test. Unfortunately, today I have lots of work on my plate, but by > tomorrow > I will have a 50M row table on which to test this hypothesis. From ssharkins at gmail.com Thu Oct 9 13:29:57 2008 From: ssharkins at gmail.com (Susan Harkins) Date: Thu, 9 Oct 2008 14:29:57 -0400 Subject: [dba-SQLServer] Views References: <57E6E6CA42105A48B977303A2CDC2720076DA2704D@WPEXCH22.retail.ad.cmltd.net.au> Message-ID: <216501c92a3d$37686550$2f8601c7@SusanOne> > The database I used will have 100,000's of rows of data rather than > millions. And probably 40 or so users hitting it at any one time - not > massive by any means. > > I read about "partitioned views" as well - again they are meant to be > fast, but I have never tried it. > > Anyone else want to add more to this? http://msdn.microsoft.com/en-us/library/ms190237.aspx SUsan H. From fhtapia at gmail.com Fri Oct 10 11:11:57 2008 From: fhtapia at gmail.com (Francisco Tapia) Date: Fri, 10 Oct 2008 09:11:57 -0700 Subject: [dba-SQLServer] Views In-Reply-To: <29f585dd0810081015o6cd085y158f682240a8c632@mail.gmail.com> References: <200810071750.m97HopEj022209@databaseadvisors.com> <162e01c928a9$cd1f3b90$2f8601c7@SusanOne> <29f585dd0810071300u1fd24e3bh7ff9642496e868d5@mail.gmail.com> <1adc01c92967$cd3ff1a0$2f8601c7@SusanOne> <29f585dd0810081015o6cd085y158f682240a8c632@mail.gmail.com> Message-ID: Arthur, I think there is a misunderstanding... see... if you send a queued command to sql server as in dynamic sql, that reads... Select * from mytable where pkid = 124.... then the sql engine will only provide the client with pkid=124, nothing else, a view works in a similar fashion to a table and thus these two statements may be synonymous select * from myview where pkid = 124 The only time that all data is returned to a client if the statement omits the where clause. This is the way that sql server works. The benefits of using a stored procedure over a view is that stored procedures follow a query plan that is usually optimized. While the later versions of sql server take advantage of cached data, it's possible that the query optimizer will choose a different path for your view even though a previous plan may have worked better for it. so in short, to a client, a view and a stored procedure return data in much the same way... the advantages of a stored procedure outweight a view because you can return a single result, a table result or xml docs and only the data you really need is returned based on the pre-programming of the stored procedure.... views can have parameters within, and any additional where clauses help to further filter down the results, but unfortuantely the view results are table result based, thus you cannot return xml docs or just simply a single value (unless it's a single column based resultset... you also can't create while loops or (dare i say) cursors within the views... so that also makes them limiting. I hope this helps clarify what data makes it to the client. btw, if the argument here is that you are linking a view directly to access then yes, all the data is sent to access and access further fileters the results by adding the where clause there, however if you link the view as a pass-through query, you loose nothing in performance by pre-filtering the results at the sql engine instead of at access. -Francisco http://sqlthis.blogspot.com | Tsql and More... On Wed, Oct 8, 2008 at 10:15 AM, Arthur Fuller wrote: > That is my understanding of the documentation, Susan. The view pulls > everything to the client, which then filters out everything not > interesting. > I could be wrong about this but it would be relatively easy to generate a > test. Unfortunately, today I have lots of work on my plate, but by tomorrow > I will have a 50M row table on which to test this hypothesis. > > A. > > On Wed, Oct 8, 2008 at 2:03 PM, Susan Harkins wrote: > > > > SELECT * FROM MyView WHERE PK = 124 > > > > > > results in the case of a view that all rows in the view are sent to the > > > client and then the client filters the result set. > > > > =======Arthur, I'm not sure I understand -- are you saying that if MyView > > contains 100 records but only 2 that satisfy the WHERE clause, the view > > still pulls all 100 records but only displays 2? > > > > Susan H. > > > _______________________________________________ > 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 Fri Oct 10 21:31:39 2008 From: fuller.artful at gmail.com (Arthur Fuller) Date: Fri, 10 Oct 2008 23:31:39 -0300 Subject: [dba-SQLServer] Views In-Reply-To: References: <200810071750.m97HopEj022209@databaseadvisors.com> <162e01c928a9$cd1f3b90$2f8601c7@SusanOne> <29f585dd0810071300u1fd24e3bh7ff9642496e868d5@mail.gmail.com> <1adc01c92967$cd3ff1a0$2f8601c7@SusanOne> <29f585dd0810081015o6cd085y158f682240a8c632@mail.gmail.com> Message-ID: <29f585dd0810101931v76b2bf87obd3a491b656a36b4@mail.gmail.com> Hi Francisco, Your last paragraph was precisely the point I was attempting to make, however inelegantly I phrased it. We are in 100% agreement on this. A. >> btw, if the argument here is that you are linking a view directly to access then yes, all the data is sent to access and access further fileters the results by adding the where clause there, however if you link the view as a pass-through query, you loose nothing in performance by pre-filtering the results at the sql engine instead of at access. -Francisco http://sqlthis.blogspot.com | Tsql and More... From Darryl.Collins at coles.com.au Sat Oct 11 05:25:35 2008 From: Darryl.Collins at coles.com.au (Darryl Collins) Date: Sat, 11 Oct 2008 21:25:35 +1100 Subject: [dba-SQLServer] Views In-Reply-To: <29f585dd0810101931v76b2bf87obd3a491b656a36b4@mail.gmail.com> Message-ID: <57E6E6CA42105A48B977303A2CDC2720076DA2706B@WPEXCH22.retail.ad.cmltd.net.au> aaaah.... *ding* ... Now I understand perfectly :) thanks -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of Arthur Fuller Sent: Saturday, 11 October 2008 1:32 PM To: Discussion concerning MS SQL Server Subject: Re: [dba-SQLServer] Views Hi Francisco, Your last paragraph was precisely the point I was attempting to make, however inelegantly I phrased it. We are in 100% agreement on this. A. >> btw, if the argument here is that you are linking a view directly to access then yes, all the data is sent to access and access further fileters the results by adding the where clause there, however if you link the view as a pass-through query, you loose nothing in performance by pre-filtering the results at the sql engine instead of at access. -Francisco http://sqlthis.blogspot.com | Tsql and More... _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com This email and any attachments may contain privileged and confidential information and are intended for the named addressee only. If you have received this e-mail in error, please notify the sender and delete this e-mail immediately. Any confidentiality, privilege or copyright is not waived or lost because this e-mail has been sent to you in error. It is your responsibility to check this e-mail and any attachments for viruses. No warranty is made that this material is free from computer virus or any other defect or error. Any loss/damage incurred by using this material is not the sender's responsibility. The sender's entire liability will be limited to resupplying the material. From stephen at bondsoftware.co.nz Sat Oct 11 23:18:16 2008 From: stephen at bondsoftware.co.nz (Stephen) Date: Sun, 12 Oct 2008 17:18:16 +1300 Subject: [dba-SQLServer] Converting Access nested queries into SPs Message-ID: <569E08FC48047F4F848850B118195FBE03834C@server.BondSoftware.local> I am converting an Access system to SQL-S back-end and Access front-end. Presently converting the queries into SPs. I use nested queries a lot - the lower levels form commonality for other specific higher level queries. Is there a way I can build SPs in this nested fashion without having to specifically repeat the lower-level code each time in the higher-level SP? Stephen Bond Otatara New Zealand From jlawrenc1 at shaw.ca Sun Oct 12 00:19:10 2008 From: jlawrenc1 at shaw.ca (Jim Lawrence) Date: Sat, 11 Oct 2008 22:19:10 -0700 Subject: [dba-SQLServer] Converting Access nested queries into SPs In-Reply-To: <569E08FC48047F4F848850B118195FBE03834C@server.BondSoftware.local> References: <569E08FC48047F4F848850B118195FBE03834C@server.BondSoftware.local> Message-ID: <4E5E06C9CD9D4B6DB5EA8EE9AF91B3B9@creativesystemdesigns.com> You can use UDFs to eliminate duplication of coding just like an Access function call or within MS SQL you can use a SQL statement as a table... I believe up to 7 levels deep. (or is that Oracle?) .. air code... Select file1.name, tableB.city >From (Select * from tableA where colour = green) as file1 Where tableB.state = 'AR' It can work like a compound query. Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Stephen Sent: Saturday, October 11, 2008 9:18 PM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] Converting Access nested queries into SPs I am converting an Access system to SQL-S back-end and Access front-end. Presently converting the queries into SPs. I use nested queries a lot - the lower levels form commonality for other specific higher level queries. Is there a way I can build SPs in this nested fashion without having to specifically repeat the lower-level code each time in the higher-level SP? Stephen Bond Otatara New Zealand _______________________________________________ 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 Sun Oct 12 21:48:47 2008 From: robert at webedb.com (Robert L. Stewart) Date: Sun, 12 Oct 2008 21:48:47 -0500 Subject: [dba-SQLServer] Converting Access nested queries into SPs In-Reply-To: References: Message-ID: <200810130259.m9D2x8r1001955@databaseadvisors.com> Use derived tables. They work great. At 12:00 PM 10/12/2008, you wrote: >Date: Sun, 12 Oct 2008 17:18:16 +1300 >From: Stephen >Subject: [dba-SQLServer] Converting Access nested queries into SPs >To: dba-sqlserver at databaseadvisors.com >Message-ID: > <569E08FC48047F4F848850B118195FBE03834C at server.BondSoftware.local> >Content-Type: text/plain; charset=us-ascii > > >I am converting an Access system to SQL-S back-end and Access front-end. > >Presently converting the queries into SPs. I use nested queries a lot - >the lower levels form commonality for other specific higher level >queries. Is there a way I can build SPs in this nested fashion without >having to specifically repeat the lower-level code each time in the >higher-level SP? > >Stephen Bond >Otatara >New Zealand From nancy.lytle at gmail.com Mon Oct 13 14:54:28 2008 From: nancy.lytle at gmail.com (Nancy Lytle) Date: Mon, 13 Oct 2008 14:54:28 -0500 Subject: [dba-SQLServer] Converting Access nested queries into SPs In-Reply-To: <569E08FC48047F4F848850B118195FBE03834C@server.BondSoftware.local> References: <569E08FC48047F4F848850B118195FBE03834C@server.BondSoftware.local> Message-ID: Stored procedures can also call other stored procedures.Nancy Lytle N_Lytle at terpalum.umd.edu EMAILING FOR THE GREATER GOODJoin me > Date: Sun, 12 Oct 2008 17:18:16 +1300> From: stephen at bondsoftware.co.nz> To: dba-sqlserver at databaseadvisors.com> Subject: [dba-SQLServer] Converting Access nested queries into SPs> > > I am converting an Access system to SQL-S back-end and Access front-end.> > Presently converting the queries into SPs. I use nested queries a lot -> the lower levels form commonality for other specific higher level> queries. Is there a way I can build SPs in this nested fashion without> having to specifically repeat the lower-level code each time in the> higher-level SP?> > Stephen Bond> Otatara> New Zealand> > > _______________________________________________> dba-SQLServer mailing list> dba-SQLServer at databaseadvisors.com> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver> http://www.databaseadvisors.com> From paul.hartland at googlemail.com Wed Oct 15 02:50:02 2008 From: paul.hartland at googlemail.com (Paul Hartland) Date: Wed, 15 Oct 2008 08:50:02 +0100 Subject: [dba-SQLServer] Trace Deadlocks Using DBCC TRACEON (1204) Message-ID: <38c884770810150050j706ebd5x791a544763cc3294@mail.gmail.com> To all, We have started getting a couple of deadlocking issues every now and again, I have read that you can turn on a trace using DBCC TRACEON (1204) Can anyone tell me, where this command will put the results in a case of a deadlock being raised. Or has anyone any better ideas, of how I can find out the queries/views/SP's that are causing the deadlocks please. I have told each of our staff to report to me immediately if they get a deadlock issue, so then I want to look at a report or log to attempt to find out what is going on. Thanks in advance for any help on this. -- Paul Hartland paul.hartland at googlemail.com From fhtapia at gmail.com Thu Oct 16 19:15:42 2008 From: fhtapia at gmail.com (Francisco Tapia) Date: Thu, 16 Oct 2008 17:15:42 -0700 Subject: [dba-SQLServer] Logical reads/writes In-Reply-To: <29f585dd0809230851x506d1db6q145b2970d8bbad01@mail.gmail.com> References: <29f585dd0809230851x506d1db6q145b2970d8bbad01@mail.gmail.com> Message-ID: Arthur, I'm assuming that you've answered your own question via Google, but in case you hadn't and since I haven't seen any responses to this message I'd thought I'd post an answer... http://msdn.microsoft.com/en-us/library/aa224763(SQL.80).aspx Data is read from the database disk files into the buffer cache. Multiple logical reads of the data can be satisfied without requiring that the data be physically read again. The data remains in the cache until it has not been referenced for some time and the database needs the buffer area to read in more data. Data is written back to disk only if it is modified. Data can be changed multiple times by logical writes before a physical write transfers the new data back to disk. so yes to answer your question a logical read is read from memory as opposed to disk. -Francisco http://sqlthis.blogspot.com | Tsql and More... On Tue, Sep 23, 2008 at 8:51 AM, Arthur Fuller wrote: > I suppose that I should know what these terms mean, but the fact is that I > don't. I'm looking at this report of object execution times from SQL 2005 > and there are columns about logical reads and writes and I have no idea > what that means. Logical as opposed to physical, or as opposed to > illogical? > Oh and then there is Total Logical IO. That would be a really funny graph > if > they had Illogical Reads and Writes LOL. > > It's time to Google, I guess. > > Arthur > _______________________________________________ > 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 Thu Oct 16 19:37:11 2008 From: fhtapia at gmail.com (Francisco Tapia) Date: Thu, 16 Oct 2008 17:37:11 -0700 Subject: [dba-SQLServer] Create error In-Reply-To: References: Message-ID: catching up on email here... but one common error that occurs on sql server is that it won't create directory paths for you. in the future when you try this again and you get the error, first verify that the path structure exists first :) -Francisco http://sqlthis.blogspot.com | Tsql and More... On Mon, Sep 22, 2008 at 11:10 AM, jean-paul wrote: > > well i dont know what happened , but now it is working- > > thanks > > > > > > > > > > > > > > > From: jnatola at hotmail.com > > To: dba-sqlserver at databaseadvisors.com > > Date: Mon, 22 Sep 2008 13:54:59 -0400 > > Subject: [dba-SQLServer] Create error > > > > > > Hi all, > > > > Please bear with me as Im new to SQL , > > ;m having an issue with creating a DB i just installed windows 2003 r2 > and sql05 the install went well no errors etc.. > > > > > > I have changed the default locations for the DB's to E: for Tlogs and F: > for the DB > > > > I'm using windows authentication , my user account is both domain admin > and local admin on the server - its not a DC- > > and I'm not on compressed drives > > > > > > The issue when I try to create a database I get the following; > > > > Create failed for database 'test1' (Microsoft.SqlServer.Smo) > > > > An exception occurred while executing a Transact-SQL statement or batch > > > > Directory lookup for the file e:\SQL_DBs\test1.mdf" failed with the > operating system error 2 (the system cannot find the file specified > > > > CREATE DATABSASE failed. Some file names listed could not be created. > Check realted errors > > (Microsoft SQL Server, Error: 5133) > > > > > > > > > > > > > > TIA > > > > J > > > > > > > > > > > > > > > > > > _________________________________________________________________ > > See how Windows connects the people, information, and fun that are part > of your life. > > http://clk.atdmt.com/MRT/go/msnnkwxp1020093175mrt/direct/01/ > > _______________________________________________ > > dba-SQLServer mailing list > > dba-SQLServer at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > http://www.databaseadvisors.com > > > > _________________________________________________________________ > See how Windows Mobile brings your life together?at home, work, or on the > go. > http://clk.atdmt.com/MRT/go/msnnkwxp1020093182mrt/direct/01/ > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > >