-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update-SQL should allow for -NoPSTypeName #15
Comments
Your timing is good, as Update-SQL is getting some updates. Update-SQL and Select-SQL are designed to give you a PowerShell-friendly object, so the .PSTypeName behavior is "by design". You can work around this design in a simple enough way as is: Without -Force, Update-SQL will not change the table you're creating. So if you don't want a PSTypeNames column, don't create one. Alternatively, if you wanted to create the table and then drop the PSTypeName column, you could do that and then avoid -Force in the future. Now since neither of these solutions is ideal, I've retitled the issue to something like what I feel the solution should be: Adding a parameter to "opt-out" of creating the PSTypeName column. Does this reply help you understand the issue? |
I'm not using -Force and the column is being added. |
I see there's some updates based on the commit. Are these changes ready for consumption or are they still work in progress? |
Not sure exactly when it is occurring, but I'm using Update-SQL to write a PSCustomObject to a table and the
pstypename
column is being dynamically added to my table.My code looks something like this:
What I suspect is happening is that I have a database constraint, such as a non-null, which is rejecting the insert. The try-catch logic in Update-SQL appears to attempt to alter the table and then try again.
How can I prevent the pstypename from being added?
The text was updated successfully, but these errors were encountered: