Solved

Initialize a variable from a flat file record

Posted on 2007-03-23
5
189 Views
Last Modified: 2010-03-19
I wonder what ways are available to read a flat file and initialize a variable without using BULK INSERT or any DB Table in the process?
0
Comment
Question by:phermi
  • 3
  • 2
5 Comments
 
LVL 9

Expert Comment

by:ripahoratiu
ID: 18791711
1. xp_sscanf
2. xp_cmdshell
0
 

Author Comment

by:phermi
ID: 18792098
thanks ripahoratiu.

We were having some permissions issues to execute the cmdshell from the web application and we discarded it.

Thanks for your reply.
0
 

Author Comment

by:phermi
ID: 18792124
ripahoratiu.

What I need is to OPEN the file, read its only 1 record and initialize a variable with the record contents.

thanks again
0
 
LVL 9

Accepted Solution

by:
ripahoratiu earned 500 total points
ID: 18792152
... ummm I think that xp_sscanf is wrong.
But you can do a little .exe where you can open the file read the record and pass it through (write it to console). Than you can use xp_cmdshell

Check this out
http://msdn2.microsoft.com/en-us/library/ms175046.aspx

0
 

Author Comment

by:phermi
ID: 18792249
thanks again ... I think we are going to stick with the BULK INSERT tinto a # table. As I said, we got permissions issues using cmdshell and being a web app, all users and even simultaneous one, must have access to the file contents.


thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

911 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now