From newsgrps at dalyn.co.nz Wed Sep 12 21:28:24 2007 From: newsgrps at dalyn.co.nz (David Emerson) Date: Thu, 13 Sep 2007 14:28:24 +1200 Subject: [dba-SQLServer] Altering temporary Tables Message-ID: <20070913022536.FGCM27104.fep03.xtra.co.nz@Dalyn.dalyn.co.nz> I have created a temporary table called @ttmpBWSGoalCashFlow in a stored procedure. I would like to add columns to the table based on the data in another table. Part of my stored procedure looks like this (Assume that cc has been declared as a cursor which returns the names of the new columns): DECLARE @col varchar(100) DECLARE @strsql varchar(4000) OPEN cc FETCH NEXT FROM cc INTO @Col WHILE @@fetch_status=0 BEGIN SELECT @strsql = 'ALTER TABLE @ttmpBWSGoalCashFlow add [' + @col + '] money' EXEC (@strsql) FETCH NEXT FROM cc INTO @Col END The error I get when I run this is "Incorrect syntax near '@ttmpBWSGoalCashFlow'". My guess is that because the temporary table is a variable, SQL can't recognise it as part of the string. Can anyone help me with the correct syntax? From newsgrps at dalyn.co.nz Wed Sep 12 21:35:25 2007 From: newsgrps at dalyn.co.nz (David Emerson) Date: Thu, 13 Sep 2007 14:35:25 +1200 Subject: [dba-SQLServer] Altering temporary Tables Message-ID: <20070913023252.FSFT27104.fep03.xtra.co.nz@Dalyn.dalyn.co.nz> For clarification, the temporary table is declared in the procedure - DECLARE @ttmpBWSGoalCashFlow table (Description varchar(100), ......) Regards David Emerson Dalyn Software Ltd Wellington, New Zealand From newsgrps at dalyn.co.nz Wed Sep 12 21:42:57 2007 From: newsgrps at dalyn.co.nz (David Emerson) Date: Thu, 13 Sep 2007 14:42:57 +1200 Subject: [dba-SQLServer] Altering temporary Tables Message-ID: <20070913024027.GEWN27104.fep03.xtra.co.nz@Dalyn.dalyn.co.nz> Doing some more research it may be that temporary tables cannot be altered. I cannot create and alter a physical table because the application running the procedure is web based and could be run simultaneously by several users. Perhaps there is a way to build a string to run when the table is initially declared? I am not sure that this is possible either. Anyone any suggestions as to how I can get around this one? Regards David Emerson Dalyn Software Ltd Wellington, New Zealand From tomlough at eircom.net Thu Sep 13 01:21:50 2007 From: tomlough at eircom.net (Thomas O Loughlin) Date: Thu, 13 Sep 2007 07:21:50 +0100 Subject: [dba-SQLServer] Altering temporary Tables In-Reply-To: <20070913022536.FGCM27104.fep03.xtra.co.nz@Dalyn.dalyn.co.nz> References: <20070913022536.FGCM27104.fep03.xtra.co.nz@Dalyn.dalyn.co.nz> Message-ID: <01d401c7f5ce$5f12e390$1d38aab0$@net> David, Instead of using a table variable, can you use a temp table (#ttmpBWSGoalCashFlow) instead? We use something similar here to create a server side crosstab Tom -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of David Emerson Sent: 13 September 2007 03:28 To: dba-SQLServer at databaseadvisors.com Subject: [dba-SQLServer] Altering temporary Tables I have created a temporary table called @ttmpBWSGoalCashFlow in a stored procedure. I would like to add columns to the table based on the data in another table. Part of my stored procedure looks like this (Assume that cc has been declared as a cursor which returns the names of the new columns): DECLARE @col varchar(100) DECLARE @strsql varchar(4000) OPEN cc FETCH NEXT FROM cc INTO @Col WHILE @@fetch_status=0 BEGIN SELECT @strsql = 'ALTER TABLE @ttmpBWSGoalCashFlow add [' + @col + '] money' EXEC (@strsql) FETCH NEXT FROM cc INTO @Col END The error I get when I run this is "Incorrect syntax near '@ttmpBWSGoalCashFlow'". My guess is that because the temporary table is a variable, SQL can't recognise it as part of the string. Can anyone help me with the correct syntax? _______________________________________________ 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 Thu Sep 13 19:19:48 2007 From: ssharkins at gmail.com (Susan Harkins) Date: Thu, 13 Sep 2007 20:19:48 -0400 Subject: [dba-SQLServer] DBA position at monster.com Message-ID: <006101c7f664$fad4a1b0$4b3a8343@SusanOne> https://monsterhires.tms.hrdepartment.com/cgi-bin/a/highlightjob.cgi?jobid=5 38 From erbachs at gmail.com Sun Sep 16 08:22:42 2007 From: erbachs at gmail.com (Steve Erbach) Date: Sun, 16 Sep 2007 08:22:42 -0500 Subject: [dba-SQLServer] General Q about Access 2003 and SQL Server 2005 Message-ID: <39cb22f30709160622g183622a7ne2592de60731dbda@mail.gmail.com> Dear Group, Is what I've heard correct: that the very nice Access-to-SQL Server connectivity ain't quite the same any more with SQL Server 2005? That is, coding stored procedures or creating tables from the Access interface, things like that? I'm hoping to be able to use Access 2003 to convert the queries contained in an Access application to views and sp's in SQL Server 2005. Am I going to be SOL? -- Regards, Steve Erbach Scientific Marketing Neenah, WI From jwcolby at colbyconsulting.com Fri Sep 21 10:38:32 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Fri, 21 Sep 2007 11:38:32 -0400 Subject: [dba-SQLServer] Bulk Insert Error. Message-ID: <008a01c7fc65$7830f7c0$6c7aa8c0@M90> I am getting the following error in a bulk insert. "Received an invalid column length from the bcp client for colid 40." The full error is below. "System.Data.SqlClient.SqlException: Received an invalid column length from the bcp client for colid 40. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObjec t stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternal() at System.Data.SqlClient.SqlBulkCopy.WriteRowSourceToServer(Int32 columnCount) at System.Data.SqlClient.SqlBulkCopy.WriteToServer(IDataReader reader) at FileImport_CSV.clsCreateTable.mReadFile(String lstrFileSpec) in C:\Documents and Settings\jwcolby\My Documents\Visual Studio 2005\Projects\FileImport-CSV\FileImport-CSV\clsCreateTable.vb:line 260" This is intermittent and occurs after tens of thousands of completed lines inserted by the bulk copy - 160K lines in the latest case. Any idea what this is all about? TryCatch is as follows. Try 'csvdata. bulkCopy.WriteToServer(csvData) mlngRecordsBulkCopied = mlngRecordsRead Catch ex As Exception strStatus = "Bulk Copy FAILED: " & ex.Message mclsDataLogger.cLogData.mMemoWriteLine(strStatus, , True) RaiseEvent evStatus(strStatus, False, True) MessageBox.Show(ex.Message) MessageBox.Show("Could not open the table: " + mstrCnn + ": table: " & mclsIOData.pTblName) Return -1 End Try I am wondering if there is a way to tell the BCP client to retry or something like that. John W. Colby Colby Consulting www.ColbyConsulting.com From jwcolby at colbyconsulting.com Fri Sep 21 13:13:14 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Fri, 21 Sep 2007 14:13:14 -0400 Subject: [dba-SQLServer] Bulk Insert Error. In-Reply-To: <008a01c7fc65$7830f7c0$6c7aa8c0@M90> References: <008a01c7fc65$7830f7c0$6c7aa8c0@M90> Message-ID: <00a701c7fc7b$14af53c0$6c7aa8c0@M90> Well, it appears that it was a simple issue of the field size being too small. It was not intermittent at all, my catch was causing the entire function to exit which caused the next file to run which had the same error but at a different record (of course!). Once I traced it down to stopping at exactly the same record every time I decided to go open up the field size for that field (and about 4 similar fields) and the import is happily running now. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Friday, September 21, 2007 11:39 AM To: dba-sqlserver at databaseadvisors.com Cc: VBA Subject: [dba-SQLServer] Bulk Insert Error. I am getting the following error in a bulk insert. "Received an invalid column length from the bcp client for colid 40." The full error is below. "System.Data.SqlClient.SqlException: Received an invalid column length from the bcp client for colid 40. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObjec t stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternal() at System.Data.SqlClient.SqlBulkCopy.WriteRowSourceToServer(Int32 columnCount) at System.Data.SqlClient.SqlBulkCopy.WriteToServer(IDataReader reader) at FileImport_CSV.clsCreateTable.mReadFile(String lstrFileSpec) in C:\Documents and Settings\jwcolby\My Documents\Visual Studio 2005\Projects\FileImport-CSV\FileImport-CSV\clsCreateTable.vb:line 260" This is intermittent and occurs after tens of thousands of completed lines inserted by the bulk copy - 160K lines in the latest case. Any idea what this is all about? TryCatch is as follows. Try 'csvdata. bulkCopy.WriteToServer(csvData) mlngRecordsBulkCopied = mlngRecordsRead Catch ex As Exception strStatus = "Bulk Copy FAILED: " & ex.Message mclsDataLogger.cLogData.mMemoWriteLine(strStatus, , True) RaiseEvent evStatus(strStatus, False, True) MessageBox.Show(ex.Message) MessageBox.Show("Could not open the table: " + mstrCnn + ": table: " & mclsIOData.pTblName) Return -1 End Try I am wondering if there is a way to tell the BCP client to retry or something like that. John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Wed Sep 26 04:25:42 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Wed, 26 Sep 2007 05:25:42 -0400 Subject: [dba-SQLServer] Mucking around Message-ID: <001201c8001f$368ff790$6c7aa8c0@M90> I found an interesting article on SQL Server central. The subject has been discussed in these hallowed halls so I thought I'd throw this out. http://www.sqlservercentral.com/articles/Advanced/lookuptablemadness/1464/ John W. Colby Colby Consulting www.ColbyConsulting.com From jlawrenc1 at shaw.ca Wed Sep 26 07:13:45 2007 From: jlawrenc1 at shaw.ca (Jim Lawrence) Date: Wed, 26 Sep 2007 05:13:45 -0700 Subject: [dba-SQLServer] Mucking around In-Reply-To: <001201c8001f$368ff790$6c7aa8c0@M90> Message-ID: <6D45D43A7C6C466BB31734B7FFC7B3DE@creativesystemdesigns.com> Hi John: Very interesting. I will just have to add that my bag of tricks. Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Wednesday, September 26, 2007 2:26 AM To: 'Access Developers discussion and problem solving' Cc: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] Mucking around I found an interesting article on SQL Server central. The subject has been discussed in these hallowed halls so I thought I'd throw this out. http://www.sqlservercentral.com/articles/Advanced/lookuptablemadness/1464/ John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Wed Sep 26 08:27:14 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Wed, 26 Sep 2007 09:27:14 -0400 Subject: [dba-SQLServer] Mucking around In-Reply-To: <6D45D43A7C6C466BB31734B7FFC7B3DE@creativesystemdesigns.com> References: <001201c8001f$368ff790$6c7aa8c0@M90> <6D45D43A7C6C466BB31734B7FFC7B3DE@creativesystemdesigns.com> Message-ID: <001e01c80040$f439ba30$6c7aa8c0@M90> LOL. Of course the article was arguing AGAINST adding that to your bag of tricks. Oh well. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence Sent: Wednesday, September 26, 2007 8:14 AM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Mucking around Hi John: Very interesting. I will just have to add that my bag of tricks. Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Wednesday, September 26, 2007 2:26 AM To: 'Access Developers discussion and problem solving' Cc: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] Mucking around I found an interesting article on SQL Server central. The subject has been discussed in these hallowed halls so I thought I'd throw this out. http://www.sqlservercentral.com/articles/Advanced/lookuptablemadness/1464/ John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Thu Sep 27 13:33:54 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Thu, 27 Sep 2007 14:33:54 -0400 Subject: [dba-SQLServer] Use Regex - Create Camel Case Message-ID: <005801c80134$f60b9320$6c7aa8c0@M90> Folks, I am looking for a regex expression (preferably with explanation) for taking an expression and creating a camel case (or PascalCase) expression. I get CSV files with headers in them. All too often the eejits that created the databases they came from used embedded spaces or other special use characters (!@#$%^&* etc) in their field names. I need to strip these special characters out completely. I also need to upper case the valid alpha character that follows any of these special characters. John colby becomes JohnColby %idiotic_Field*name becomes IdioticFieldName Etc. It appears that Regex is the key (I am doing this in VB.Net) but until today I have never really tried to use RegEx and it ain't pretty! Any help in this would be much appreciated. John W. Colby Colby Consulting www.ColbyConsulting.com From jlawrenc1 at shaw.ca Thu Sep 27 19:58:14 2007 From: jlawrenc1 at shaw.ca (Jim Lawrence) Date: Thu, 27 Sep 2007 17:58:14 -0700 Subject: [dba-SQLServer] SQL question In-Reply-To: <001201c8001f$368ff790$6c7aa8c0@M90> Message-ID: <621B3C4B68A3454FAFCE5AE050787B9B@creativesystemdesigns.com> Can a sequence of numbers be created in a sequel list? Example: Given a list like: George Sally Robert Henry John Mary Can the piece of sequel code be modified to produce/create the following list? George 0 Sally 1 Robert 0 Henry 1 John 0 Mary 1 TIA Jim From pcs at azizaz.com Sun Sep 30 08:40:15 2007 From: pcs at azizaz.com (pcs at azizaz.com) Date: Sun, 30 Sep 2007 23:40:15 +1000 (EST) Subject: [dba-SQLServer] [dba-sqlserver] Access BE tables - migrate to SQL2005 Message-ID: <20070930234015.DEA22307@dommail.onthenet.com.au> Using the SQL Server migration assistant for Access I've migrated the BE Db OK. I have a warning message for a number of field names that have this in common: they all start with a digit, for example 2ndEvent; 95Feb; etc. The message reads: SQL Server Migration Assistant for Access Warning message: Identifier name might cause problems Column '95Feb' has a name that might cause problems for the Access application to function correctly against SQL Server. Do I need to be concerned enough to change to field names? And why? Regards Borge From fuller.artful at gmail.com Sun Sep 30 09:18:29 2007 From: fuller.artful at gmail.com (Arthur Fuller) Date: Sun, 30 Sep 2007 10:18:29 -0400 Subject: [dba-SQLServer] [dba-sqlserver] Access BE tables - migrate to SQL2005 In-Reply-To: <20070930234015.DEA22307@dommail.onthenet.com.au> References: <20070930234015.DEA22307@dommail.onthenet.com.au> Message-ID: <29f585dd0709300718p6d361ef3s85b6e0a6912a838d@mail.gmail.com> Yes, you need to be concerned. You might use a tool such as Rick Fisher's Find and Replace to find and replace all such column names with more acceptable names (such as Event2 and Feb95). Do this on a backed-up copy of your BE. Rick's program is excellent at finding all occurrences of target strings -- it looks everywhere: in queries and tables and code strings etc. hth, Arthur On 9/30/07, pcs at azizaz.com wrote: > > Using the SQL Server migration assistant for Access I've > migrated the BE Db OK. > I have a warning message for a number of field names that > have this in common: they all start with a digit, > for example 2ndEvent; 95Feb; etc. > > The message reads: > SQL Server Migration Assistant for Access Warning message: > Identifier name might cause problems > Column '95Feb' has a name that might cause problems for the > Access application to function correctly against SQL Server. > > Do I need to be concerned enough to change to field names? > And why? > > Regards > Borge > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > >