To write some dummy stored-procedures I was wondering if I could just write them in C# since I don't know T-SQL very well.
Are C# and T-SQL versions of the same procedure indistinguishable to calling code eg C++/C#/Java code using standard database library classes?
Yes, the caller won't know the difference. However, there are a few API differences:
NVARCHAR(MAX)
, VARBINARY(MAX)
, and XML
) cannot have default values in SQLCLR objects. (Microsoft Connect suggestion to vote for, perhaps: Support default parameter values for NVARCHAR(MAX), VARBINARY(MAX), and XML types in SQLCLR objects ) SMALLDATETIME
SMALLMONEY
CHAR
VARCHAR
TEXT
NTEXT
IMAGE
Outside of that technical answer to the Question, there are some things to consider:
What exactly is being considered "dummy"? Are you just needing a signature? If so, it would be far easier to do that in plain T-SQL. All it takes for T-SQL to do a mock stored procedure is:
CREATE PROCEDURE SchemaName.ProcedureName ( @Param1name Param1Type, @Param2name Param2Type, ... ) AS SELECT CONVERT(resultField1type, NULL) AS [resultField1name], CONVERT(resultField2type, NULL) AS [resultField2name], ... ;
The term "dummy" implies that these will be replaced with something else later. What will they be replaced with? T-SQL Stored Procedures? Who will write those if you don't know T-SQL?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.