Advertisement
Guest User

Untitled

a guest
Apr 28th, 2015
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. public class Class1
  2. {
  3. public static SqlString GetName(SqlString str)
  4. {
  5. SqlCommand cmd = new SqlCommand(str.ToString());
  6. cmd.CommandType = System.Data.CommandType.Text;
  7.  
  8. string name = cmd.ExecuteScalar().ToString();
  9. return name;
  10. }
  11. }
  12.  
  13. CREATE FUNCTION fn_TestConnection
  14. (
  15. @str nvarchar(255)
  16. )
  17. RETURNS nvarchar(max)
  18. AS EXTERNAL NAME TestConnection.[TestConnection.Class1].GetName
  19.  
  20. GO
  21.  
  22. SELECT dbo.fn_TestConnection('SELECT FName FROM Clients WHERE Id = 1' )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement