Login or Sign Up to become a member!
LessThanDot Sit Logo

LessThanDot

Data Management

Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.

LTD Social Sitings

Lessthandot twitter Lessthandot Linkedin Lessthandot friendfeed Lessthandot facebook Lessthandot rss

Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.

Your profile

    Search

    XML Feeds

    Google Ads

    « MongoDB: How to backup all the databases with one commandMongoDB: How to restore collections »
    comments

    Sometimes the creativity of the human species is truly amazing. Someone needed to export a table into a file from within SQL Server. Now there are several ways to do this like bcp, export wizard, Query..Results To File, SSIS etc etc. Today I noticed someone found yet another way....

    This person decided to use a SQL Agent job to create the file. That is still not strange but here comes the interesting part...

    Here is what the person did, first a job was added with a query.

    Then in the Advanced part of the step an output file was chosen

    This of course will create the file, however there will be some output in the from the job itself

    The only reason I found out about this was because I was asked how to skip the 'header' in SQL Server. After a good deal of puzzlement looking at this creative 'solution' I told the person how to use bcp instead

    Any crazy stories from the trenches you want to share in the comments?

    About the Author

    User bio imageDenis has been working with SQL Server since version 6.5. Although he worked as an ASP/JSP/ColdFusion developer before the dot com bust, he has been working exclusively as a database developer/architect since 2002. In addition to English, Denis is also fluent in Croatian and Dutch, but he can curse in many other languages and dialects (just ask the SQL optimizer) He lives in Princeton, NJ with his wife and three kids.
    Social SitingsTwitterFacebookLinkedInHomePageFlickrLTD RSS Feed
    2231 views
    InstapaperVote on HN

    4 comments

    Comment from: Ted Krueger (onpnt) [Member]
    Ted Krueger (onpnt) I'm pretty confident you took the award for finding the most creative and stupid method of getting a task done in SQL Server.
    01/31/13 @ 17:47
    Comment from: SQLDenis [Member] Email
    SQLDenis It is baffling in a way, from all the documented ways that are available why going this path. I mean how do you even find this stuff? It is probably the name Output File that lead them down this rabbit hole
    01/31/13 @ 17:52
    Comment from: Koen Verbeeck [Member] Email
    O.M.G.
    It sure is creative :)

    Crazy stories? Sure I'll share one.
    How about executing a query inside a cursor with count(*). If the count is bigger than 0 (meaning a row is returned), execute the query again, but now with the column needed to populate a variable.

    Because the cursor wasn't bad enough already, they did every query twice :)

    ps: like your UmmmNo pic. I might use it someday :)
    02/01/13 @ 00:07
    Comment from: Tahir Khalid [Member] Email
    Isn't Oracle one big crazy heap of craziness?
    02/01/13 @ 08:43

    Leave a comment


    Your email address will not be revealed on this site.

    To mislead the spambots.

    Your URL will be displayed.
    (Line breaks become <br />)
    (Name, email & website)
    (Allow users to contact you through a message form (your email will not be revealed.)