I have a homework problem that requires me to create a procedure that uses a dll assembly. The procedure is suppose to return environment values. The following is my procedure:CREATE PROC dbo.usp_GetEnvInfo(@envProperty NVARCHAR(20),@machineName NVARCHAR(256),@processors VARCHAR(255),@osVersion VARCHAR(255),@clrVersion VARCHAR(255))AS EXTERNAL NAME uspGetEnvInfo.StoredProcedures.usp_GetEnvInfo
Here is the assembly code:using System;using System.Data;using System.Data.SqlClient;using System.Data.SqlTypes;using Microsoft.SqlServer.Server;using System.Text.RegularExpressions;using System.Globalization;public partial class StoredProcedures{ // Stored procedure that returns environment info in tabular format [Microsoft.SqlServer.Server.SqlProcedure] public static void usp_GetEnvInfo() { // Create a record - object representation of a row // Include the metadata for the SQL table SqlDataRecord record = new SqlDataRecord( new SqlMetaData("EnvProperty", SqlDbType.NVarChar, 20), new SqlMetaData("Value", SqlDbType.NVarChar, 256)); // Marks the beginning of the result set to be sent back to the client // The record parameter is used to construct the metadata // for the result set SqlContext.Pipe.SendResultsStart(record); // Populate some records and send them through the pipe record.SetSqlString(0, @"Machine Name"); record.SetSqlString(1, Environment.MachineName); SqlContext.Pipe.SendResultsRow(record); record.SetSqlString(0, @"Processors"); record.SetSqlString(1, Environment.ProcessorCount.ToString()); SqlContext.Pipe.SendResultsRow(record); record.SetSqlString(0, @"OS Version"); record.SetSqlString(1, Environment.OSVersion.ToString()); SqlContext.Pipe.SendResultsRow(record); record.SetSqlString(0, @"CLR Version"); record.SetSqlString(1, Environment.Version.ToString()); SqlContext.Pipe.SendResultsRow(record); // End of result set SqlContext.Pipe.SendResultsEnd(); }};
The problem I'm having is that whenever I try to create the procedure I get the following error:Msg 6550, Level 16, State 2, Procedure usp_GetEnvInfo, Line 1CREATE PROCEDURE failed because parameter counts do not match.I was hoping someone could help me figure out what I need to make the procedure work.Thanks