Solved

error executing store procedure

Posted on 2006-11-10
1
1,585 Views
Last Modified: 2008-01-09
I need to insert all user name for table A into aspnet_membership table. I have to user stored procedure. this is what have so far but it complains about syntax at *** see below.  
--------------------------------------------------------------------
select  UserName into #tmpU from  Rams.dbo.tt_users
select * from #tmpU
 
Declare @cnt int
 
Set @cnt = 0

while @Cnt < (Select count(*) from #tmpU)
Begin
             

   EXEC       [dbo].[aspnet_membership_createuser]
 *** @UserName = #tmpU.UserName, @Password = 'mypassword' +  Convert(varchar(3000),@Cnt)),
      @PasswordSale = null,@Email = #tmpU.UserName,@PasswordQuestion='mypassword',
      @PasswordAnswer='mypassword',@IsApproved = 0,@CurrentTimeUtc=GetDate(), @CreateDate= null,@UniqueEmail=#tmpU.UserName,
      @PasswordFormat= null

End
----------------------------------------------------------------------
I cannot figure out what is the problem. I was passing values with setting @UserName etc but still have same issu.

appreciate it
-kushpaw
0
Comment
Question by:kushpaw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 29

Accepted Solution

by:
Nightman earned 125 total points
ID: 17918277
If this is for MSSQL, try the following:


Declare @cnt int
Declare @username varchar(20)
Declare @MyPassword varchar(20)
Declare @Datestamp datetime
Set @cnt = 0
DECLARE tCursor CURSOR fast_forward
FOR
  SELECT
    UserName
  FROM
    Rams.dbo.tt_users
FOR READ ONLY
OPEN tCursor
FETCH next from tCursor into @username
WHILE @@FETCH_STATUS = 0
BEGIN
  set @cnt=@cnt+1
  set @MyPassword='mypassword' +  Convert(varchar(3000),@Cnt)
  set @Datestamp=getdate()
   EXEC      [dbo].[aspnet_membership_createuser]
      @UserName = @username,
      @Password = @MyPassword,
      @PasswordSale = null,
      @Email = @username,
      @PasswordQuestion='mypassword',
      @PasswordAnswer='mypassword',
      @IsApproved = 0,
      @CurrentTimeUtc = @Datestamp,
      @CreateDate = null,
      @UniqueEmail = @username,
      @PasswordFormat = null

FETCH NEXT FROM tCursor INTO @username
END
CLOSE tCursor
DEALLOCATE tCursor
0

Featured Post

Get Database Help Now w/ Support & Database Audit

Keeping your database environment tuned, optimized and high-performance is key to achieving business goals. If your database goes down, so does your business. Percona experts have a long history of helping enterprises ensure their databases are running smoothly.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. This article shows how to create one of these functions to write directly to Azure Table Storage.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question