Skip to content

Update SqlFacetAttribute.xml to indicate possible usage on input parameters #4477

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

Merged
merged 2 commits into from
May 10, 2023

Conversation

allmhuran
Copy link
Contributor

Document implies SqlFacets can only be used with return types. But they can also be used with input parameters.

Summary

Describe your changes here.

Fixes #Issue_Number (if available)

Document implies SqlFacets can only be used with return types. But they can also be used with input parameters.
@dotnet-bot dotnet-bot added this to the July 2020 milestone Jul 7, 2020
@gewarren gewarren requested a review from stevestein July 9, 2020 02:30
@gewarren
Copy link
Contributor

gewarren commented Jul 9, 2020

@stevestein Can you review this please?

Copy link

@stevestein stevestein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@allmhuran - this attribute is intended to be used for the return type.

An optional attribute on a user-defined type (UDT) return type, used to annotate the returned result with additional information that can be used in Transact-SQL.

SqlFacetAttribute is used only to derive information about the return type, and is not intended to be a constraint specification on what can be stored in the type. Thus, if a field has a SqlFacetAttribute indicating its size to be 2 characters, then the SQL Server type of the field access expression is of size 2, but assignments into the field are not restricted by this facet.

So while you may be able to apply the SqlFacetAttribute to an input parameter, what is the actual scenario?

@allmhuran
Copy link
Contributor Author

allmhuran commented Jul 11, 2020

@stevestein When publishing a SQLCLR UDF via Visual Studio, the user in the stackoverflow thread (below) found that the deployed object treated the input parameter numeric as (18,0). The attribute was able to be used to inform the deployment such that the input parameter was not necessarily treated as (18,0). The user was given the impression that the facet could only be used on return, as I believe is implied by the existing documentation. Solomon Rutzky indicated that, regarding input or output, the facet "is definitely intended for both, even if the examples are lacking".

Perhaps there is a more comprehensive way to indicate this in the documentation than my proposed edit.

https://stackoverflow.com/questions/62773147/set-decimal-precision-in-sql-clr-function-in-c-sharp

@carlossanlop
Copy link
Contributor

Ping @stevestein - can you please follow up?

Base automatically changed from master to main March 5, 2021 20:52
@gewarren gewarren requested a review from a team as a code owner March 5, 2021 20:52
@BillWagner
Copy link
Member

ping @carlossanlop @stevestein to follow up.

@ghost
Copy link

ghost commented Jan 4, 2022

Tagging subscribers to this area: @cheenamalhotra, @David-Engel
See info in area-owners.md if you want to be subscribed.

Issue Details

Document implies SqlFacets can only be used with return types. But they can also be used with input parameters.

Summary

Describe your changes here.

Fixes #Issue_Number (if available)

Author: allmhuran
Assignees: -
Labels:

area-System.Data.SqlClient

Milestone: July 2020

@learn-build-service-prod
Copy link

Learn Build status updates of commit 1a791af:

✅ Validation status: passed

File Status Preview URL Details
xml/Microsoft.SqlServer.Server/SqlFacetAttribute.xml ✅Succeeded

For more details, please refer to the build report.

For any questions, please:

@allmhuran
Copy link
Contributor Author

@dotnet-policy-service agree

@gewarren gewarren merged commit 4b3bffa into dotnet:main May 10, 2023
@allmhuran allmhuran deleted the patch-2 branch May 10, 2023 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants