Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Initialize a variable from a flat file record

Posted on 2007-03-23
5
Medium Priority
?
241 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
[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
  • 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 1500 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

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

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…
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
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.

618 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