DEFECT 5.3.2: Table Variable not prompted
PDinCA
Posts: 642 Silver 1
SP has only 250 lines, including many comments, so the <ParserLookBackDistance> engine setting is not in play. I took the precaution of setting it to 15000 as I have couple of humongous SPs, but as soon as I restarted SSMS it bombed saying "object not set to an instance of an object" for the first connection to a User database...
BTW, I set the <ParserLookAheadDistance> to 13000 from its default 3000 and the entire SSMS exceptioned when restarted! Couldn't even bring up the shell - forget that! Moved on to just the look-back...
These TWO exceptions aren't the subject of this post, though...
The SP I'm editing has TWO table variables @METER and @DELETE. As soon as I attempt to reference anything to do with @METER after the declaration of @DELETE, I get absolutely NO suggestions. This is a defect.
The @METER TV is declared near the top of the code. @DELETE is only declared when it is determined that there are deletes to be performed. So if there are > 0 rows in @METER, @DELETE is declared and populated via an OUTPUT INTO within the DELETE FROM.
Environs:
Using SSMS2008R2 connected to a remote server running SS2005EE under Win2008Server. Local box is Win2003Server.
BTW, I set the <ParserLookAheadDistance> to 13000 from its default 3000 and the entire SSMS exceptioned when restarted! Couldn't even bring up the shell - forget that! Moved on to just the look-back...
These TWO exceptions aren't the subject of this post, though...
The SP I'm editing has TWO table variables @METER and @DELETE. As soon as I attempt to reference anything to do with @METER after the declaration of @DELETE, I get absolutely NO suggestions. This is a defect.
The @METER TV is declared near the top of the code. @DELETE is only declared when it is determined that there are deletes to be performed. So if there are > 0 rows in @METER, @DELETE is declared and populated via an OUTPUT INTO within the DELETE FROM.
Environs:
Using SSMS2008R2 connected to a remote server running SS2005EE under Win2008Server. Local box is Win2003Server.
Jesus Christ: Lunatic, liar or Lord?
Decide wisely...
Decide wisely...
Comments
I've haven't been able to reproduce this in a test case, so would you be able to post an example that reproduces this?
I've tried the following, which prompted me for @Meter at the <cursor>
Decide wisely...
I edited the usp_CacheDelete SP and at the penultimate line shown below tried to add to the JOIN - NO SUGGESTIONS from m.
Decide wisely...
TWO things:
1. If having the DEFAULT set to a pitifully low 5000 eventuates in so much frustration, not only for me, WHY is it set so LOW? 2. Given this is an SP of a mere 250 LINES, and my largest, due to it's inescapable complexity, is currently over 2600 LINES (175,773 CHAR), with other very complex SPs at 1400+ LINES, what should my lookback value be set at, please? I absolutely NEED the entire SP to be covered by the abilities of SQL Prompt's suggestions mechanism...
Given that, as you said Chris, in your email, UTF-8 vs. UTF-16 makes a difference, please:
1. Enhance SQL Prompt so it recognizes the encoding and sets a default lookback value based on 1- or 2-bytes per visible character. 2. Consider significantly increasing the default lookback to support at least a 250 LINE SP, that, in my case, uses DOS\Windows encoding and is ONLY 8705 characters in total length. 3.
Fix what appears to be a lookback BUG that requires me to set the value to 100,000 BYTES for a file that can only be 2x8705 BYTES raw max size. Perhaps SQL Prompt's lookback needs to consider what the SSMS script editor does to files presented to it, including what a user's custom background color may entail, so that the byte-count is realistic. To replicate my SSMS environment, I use a custom color background of RGB 252/253/204, which is much more restful on the eyes than stark white, IMO, and Lucida Console 8pt. Even at 50,000 BYTES lookback, my 8705 CHAR file still couldn't elicit a suggestion at line 183, CHARACTER 6,768, which appears to point to a defect in SQL Prompt somewhere...Decide wisely...
I seem to get almost the opposite of what you're finding in point 3. With your script, I only stop getting suggestions when I set the value to below 7100, which is nowhere near the original declaration based on 1 byte per character. You seem to need to set nearly 4 bytes per character on your system.
There might be some significant differences in our systems, but I would think it should still be more consistent.
I'd like to see if I can replicate the problem you're having, so could you tell me:
1) Your OS and service packs
2) Exact version of SSMS
3) The encoding of a .SQL file when you save a script in SSMS.
For your reference, I've logged this issue as bug SP-4394.
SSMS:
How does one ascertain the encoding, please, as there's nothing in the tools==> options dialog that I can see?
Thanks for picking this up, Chris.
Decide wisely...
The easiest way to check the encoding is to save the file to disk, and then open it in notepad++. You can then find the encoding through the 'encoding' menu item.
Decide wisely...
I just created an SP in SSMS and saved per my usual encoding. Having tested it, I dragged it into SQL Multi Script and made one change, from ALTER to CREATE, then ran it against my remaining 5 servers.
I then hit Ctrl+Z to revert to ALTER and, just to keep SQL Multi Script happy, saved it.
Upon return to SSMS I received the customary "file has changed - reload" prompt, which this time I said "Yes" to. The result was an unreadable file, a snippet of which looks like this:
When I dragged the file to Notepad++, the Encoding is "ASCII".
Obviously, this is highly undesirable...
Having closed the file in SSMS and then re-opening it, it is now readable, just like normal .sql files. If I then save it in SSMS and accept Notepad++'s offer to reload a changed file, the visual style in Notepad++ doesn't change - the SQL Language is still recognized, but when I click to see the Encoding, there is none at all - the usual dot-beside-the-encoding is entirely absent.
Does this give you any more clues about the loss of prompting and the Encoding being a participant?
Earlier in the day, for another ticket, now solved, I uninstalled 5.3.0.3 and installed SQL Prompt 5.3.2 and left the defaults as-is.
Also, while editing the SP, I lost parameter-prompting at line 358, which is an EXEC of an SP that lives in the dbo schema of the same database as the SP I was editing that lives in the reports schema. The parameters referred to are the inputs to the SP being edited that would not appear in the suggestion list while matching @param = @param for the EXEC. This was prior to my drag-change-exec-revert, etc. described above.
Decide wisely...