Why does the Create script for a temp-table not show datatype for all columns?
gerthauan
Posts: 9 New member
in SQL Prompt
If I am in a session in SSMS where I have created a temp-table using a select into query, then when I hower over this temp-table-name in the query after, and click on it to show the create script, the create script will often miss data types for some columns. Is this a bug? Would it be possible to fix?
An examle:
An examle:
CREATE TABLE [#SomeTempTable]
(
[sektor] INT,
[Rapporteringsperiode] VARCHAR(11) NOT NULL,
[aar] SMALLINT,
[innDato] DATE,
[utDato] DATE,
[InnMnd],
[pas_id],
[pas_reg2] SMALLINT
)
In this example, two of the columns have no data type.
)
In this example, two of the columns have no data type.
Tagged:
Best Answer
-
Jon_Kirkwood Posts: 424 Silver 5
Hi @gerthauan
Thank you for your patience whilst our development team worked on this issue.
Version 10.13.13 has been released, which includes a fix for this issue.
Are you able to patch at your earliest convenience and verify this has been resolved for youDownload of the latest version available here: https://download.red-gate.com/checkforupdates/SQLPrompt/SQLPrompt_10.13.13.2147.exe
Patch notes available here: https://documentation.red-gate.com/sp/release-notes-and-other-versions/sql-prompt-10-13-release-notes
SQL Prompt 10.13 release notes
10.13.13.2147 - Released on 22 August 2023Features
- Added a feature for saving SQL History advanced search settings.
- Added support for multiple syntaxes on Azure SQL database.
Fixes
- Fixed an issue with connecting via Azure Active Directory with MFA for SSMS19.1.
- Fixed AT TIME ZONE expressions recognition.
- Fixed formatting issue for TRIM in SQL Server 2022.
- Fixed "Could not load file or assembly System.Threading.Tasks.Extensions" error occurring when using Azure Active Directory authentication methods.
- Fixed an issue with columns not having data type when created by CAST function.
Jon Kirkwood | Technical Support Engineer | Redgate Software
Answers
Thanks for reaching out to us regarding this, I'm sorry you are seeing this issue in SQL Prompt!
I've tried to reproduce the behavior you are seeing here but have so far been unsuccessful.
Would you mind confirming what versions of SQL Prompt and SSMS you currently have installed?
Also, have you noticed that specific data types are being omitted? Or does it happen with multiple data types?
Dan Jary | Redgate Software
Have you visited our Help Center?
I have been digging a bit more into this, and it seems to me that if the column was created from a cast of the original value, the data type will disappear in the SQLPRompt create script.
Here is an example:
If i now hove over the #TempTableName and click the "tooltip", the following create statement is made:
As you can see, the two columns that was created using a CAST, is missing the data type.
My sincere apology for the delay in coming back to you on this!
After many failed attempts, I am now finally seeing the same behavior you are reporting. Specifically, that there are no data types for columns created from a cast in the SQL Prompt create script.
This is now with our development team, I will come back to you again as soon as I have an update for you on this.
Dan Jary | Redgate Software
Have you visited our Help Center?
If I use the same example again:
If I hover over the #TempTableName and collect the create table script that SQLPrompt is suggestion, it turns out like this:
As you can see, the column created with CASE-expression, the one named TypeDescWithCast, has no data type in the create table-script.
Could you pass this along to the developers?
Thx