Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. travisbrown

    SCOPE_IDENTITY not erring, but not working either.

    Indeed. I wonder how this works. MAX returns the same value before and after the INSERT. The second MAX should be 571 higher. parameter_limit_id is an ID column. SELECT COALESCE(MAX(parameter_limit_id),0) FROM [dbo].[parameter_limits]; SET @sSQL = 'INSERT INTO [dbo].[parameter_limits] SELECT...
  2. travisbrown

    SCOPE_IDENTITY not erring, but not working either.

    And running a trace shows the sequential queries executing.
  3. travisbrown

    SCOPE_IDENTITY not erring, but not working either.

    Hmm. Not sure what's going on here. The second query here it printing out the correct queries, but seems like only the first iteration is being executed. SET @sSQL = 'INSERT INTO [dbo].[standard_parameter_limits] SELECT ' + @standard_id + ', parameter_limit_id FROM [dbo].[parameter_limits]...
  4. travisbrown

    SCOPE_IDENTITY not erring, but not working either.

    Here was the winning/working solution using MAX. Looks like you can't use TOP in declaring a SELECT variable. USE [keystone_standards] DECLARE @standard_name NVARCHAR(12); DECLARE @standard_id NVARCHAR(3); DECLARE @sSQL NVARCHAR(MAX); DECLARE @counter AS INT; DECLARE @totalrows AS INT...
  5. travisbrown

    SCOPE_IDENTITY not erring, but not working either.

    Because @standard_name in the SELECT is a column name, not a value. Can't run dynamic SQL like that, can you?
  6. travisbrown

    SCOPE_IDENTITY not erring, but not working either.

    I suspected it might have something to do with running dynamic SQL and EXEC closing the scope. Your explanation seems to fit. And would explain why @@IDENTITY returns something. I guess I could use MAX reasonably safely since it's not a transactional DB.
  7. travisbrown

    SCOPE_IDENTITY not erring, but not working either.

    Curiously @@IDENTITY works. Probably safe in this case, but not sure why SCOPE_IDENTITY fails.
  8. travisbrown

    SCOPE_IDENTITY not erring, but not working either.

    Trying to figure out what I'm doing wrong here. About half way down I'm trying to get the SCOPE_IDENTITY() from the last insert. No error, but won't run any line referencing the SCOPE_IDENTITY var. This is simply a one-off process, so don't look at as an eventual sproc. DECLARE...
  9. travisbrown

    Counting and Limiting Words in Word 2007 Form Fields

    Is there a way to limit the number of words in an input text field in Word 2007? I was handed a document with spaces for multiple text areas that they want word-limited with various limits and a countdown of words left (195/200, 454/750, etc.) I found a couple of samples, but can't seem to get...
  10. travisbrown

    Dynamic Pivot/Crosstab with string values

    Looks so obvious now :) Thanks. Good catch.
  11. travisbrown

    SQL Query to split strings into multiple fields and multiple records

    Well, here is a UDF you can use as a starting point. You'd have to monkey around to try find the right split point. Might be best to split record items into rows using something like below, then concatenate back together using STUFF with a test on each concatenation so you don't exceed 50...
  12. travisbrown

    Dynamic Pivot/Crosstab with string values

    The fact that it seems to be correct *is* the problem :) With MAX I'm getting NULL for pivoted values. If I use COUNT just to test, I get 0.
  13. travisbrown

    Dynamic Pivot/Crosstab with string values

    I'm working with two existing and populated tables in SS2005 and trying to pivot one of them up into a join. The first table is a master table of contest entrants. The second table is an index of keys and values related to the contest entries. So for example: TBL_CONTESTS 123 | Joe | Blow |...
  14. travisbrown

    Updating Excel data with DSN-less connection.

    Ah. I'm doing something wrong because Excel seems to make me set up a DSN as part of that process. This is along the lines of what I remember - setting up a connection then editing the connection string to use an ADOBD or Jet driver rather than a file DSN.
  15. travisbrown

    Updating Excel data with DSN-less connection.

    Thanks Skip. But isn't your FAQ specifying how to query an Excel sheet, not a SS db? Where would you save the connection string?
  16. travisbrown

    Updating Excel data with DSN-less connection.

    And MS Query is how I got the data in there first time. I'm just trying to figure out how to modify the connection so it's not dependent on a DSN.
  17. travisbrown

    Updating Excel data with DSN-less connection.

    Ah, because I have to deliver this Excel sheet to multiple people and I want the Excel file to be populated with the most recent data from a SQL Server DB every time they open it. I don't want them to have to configure a DSN and it will get passed around and forwarded, etc.
  18. travisbrown

    Updating Excel data with DSN-less connection.

    Yes, thanks. I've been searching using those keywords for a while before hitting Tek-Tips. Lots of instructions on how to read/write an Excel file from an external scripts, etc. Used to be that I could find amidst all that a couple instructions on how to get an Excel file to auto-update on...
  19. travisbrown

    Updating Excel data with DSN-less connection.

    Well, I don't have a problem figuring out the connection string for SS, but have no recollection how to set it up in Excel. And I've seen the KB article from MS. Seems that I once wrote a SUB that executed on open. I'm trying to figure out where to specify the connection string in Excel.
  20. travisbrown

    Updating Excel data with DSN-less connection.

    Used to be that I could find instructions on how to set up Excel to update on open from a SQL Server table using a DSNless connection. Now I can't seem to find instructions anywhere. Can anyone guide me through this?

Part and Inventory Search

Back
Top