Solved

Initialize a variable from a flat file record

Posted on 2007-03-23
5
218 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

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…
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

749 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