From: Shin Zhang [MSFT] on
Since you already have the workaround, this hint might be too late.

Try to search for help on 'OPENROWSET'. It can open anything you allow to
open.

Hope it helps,
--
Shin
MS SQL Server


"odeddror" wrote:

> Hi there,
>
> I created a table with two columns FirstName and LastName
> --MyTable
> CREATE TABLE [dbo].[myTable](
> [FirstName] [nvarchar](50) NULL,
> [LastName] [nvarchar](50) NULL
> ) ON [PRIMARY]
> GO
>
> Then I created a Proc with paraters for inserting FirstName and LastName
> --DynamicParam
> Create Proc usp_DynamicParam
> @Fname varchar(50),
> @Lname varchar(50)
> AS
> Insert into myTable(FirstName,LastName)
> Values (@Fname,@Lname)
> GO
>
> I checked to see if it works
> Exec usp_DynamicParam 'Ed','Dror'
> GO
> Select * from MyTable
>
> And it works
>
> Now concider this
> I have a csv file with 10 names
>
> And I wanted to create a cursor that execute the StoredProc and read every
> time from the csv file
>
> This is the only method that I can use (I can't use bcp or command shell or
> ssis)
> I just want to see if this method is possible to do?
>
>
> Somthing like this
>
> DECLARE @List varchar(50)
> DECLARE c1 CURSOR READ_ONLY
> FOR
> Read from My csv file
> OPEN c1
> FETCH NEXT FROM c1
> INTO @List
> WHILE @@FETCH_STATUS = 0
> BEGIN
>
> Exec usp_DynamicParam + Read from csv file
>
> FETCH NEXT FROM c1 INTO @List
> END
> CLOSE c1
> DEALLOCATE c1
>
> Thanks
> Oded Dror
>
>
>
>
>