text: ﻿CREATE PROCEDURE [dbo].[BugNet_IssueAttachment_CreateNewIssueAttachment]
    @IssueId int,
    @FileName nvarchar(250),
    @FileSize Int,
    @ContentType nvarchar(50),
    @CreatorUserName nvarchar(255),
    @Description nvarchar(80),
    @Attachment Image
  AS
  -- Get Uploaded UserID
  DECLARE @UserId UniqueIdentifier
  SELECT @UserId = UserId FROM Users WHERE UserName = @CreatorUserName
  INSERT BugNet_IssueAttachments
  (
  	IssueId,
  	FileName,
  	Description,
  	FileSize,
  	ContentType,
  	DateCreated,
  	UserId,
  	Attachment
  )
  VALUES
  (
  	@IssueId,
  	@FileName,
  	@Description,
  	@FileSize,
  	@ContentType,
  	GetDate(),
  	@UserId,
  	@Attachment
  	
  )
  RETURN scope_identity()
  