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...
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]...
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...
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.
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...
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...
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...
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 |...
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.