Miscellaneous

Technical Article

Populate a table with a directory's file info.

  • Script

I use this SP to return full directory information into a table.  FilePath, FileName, Filedate and FileSize are parsed from a 'dir /n/on/-c ' command. FilesInDir is the table created. usage: exec LoadFileDetailsIntoTable 'c:\winnt'select * from FilesInDir where filesize > 100000select min(fileDate) from FilesInDirThe Return Code will equal the number of files found.

You rated this post out of 5. Change rating

2002-03-05

459 reads

Technical Article

spFindTableInfo

  • Script

spFindTableInfo is a great proc for finding info about your database.  It will accept parameters like tablename, fieldname, size, datatype.  So you can run it with no params, and it'll report every table, every field in those tables, and the size, datatype and whether its nullable or not.  You can filter it by Table name […]

You rated this post out of 5. Change rating

2002-03-05

378 reads

Technical Article

spAddField

  • Script

spAddField is the proc I use to add all fields to the db in our upgrade scripts.  With this proc, you pass it the tablename, fieldname, datatype, and null or not null.  This will call spGetFieldsExists and see if the fields exists or not.  If it does, spAddField will drop that column.  Then it readds […]

You rated this post out of 5. Change rating

2002-03-05

217 reads

Technical Article

Return formatted datetime as a string

  • Script

Pass a datetime value and receive back a formatted string. Much like the Format$ function in Visual Basic.I put this together to provide a date string to add to filename. Also handy when you are creating text files that require datetime data to be output in weird character formats like yyddmm or yyyymm.eg: fnDate2Char(GetDate(), 'dmy', […]

You rated this post out of 5. Change rating

2002-02-27

822 reads

Technical Article

Recompile Views/SPs from DOS from .SQL Files.

  • Script

This script is very helpful for anyone trying to recreate particular SQL Server Database Versions for Testing.  It allows you to automatically recompile any stored procedures or views saved with drop, create and permission statements.  The scripts must all be sitting in one directory and end in the same extension.  I have found this very […]

You rated this post out of 5. Change rating

2002-02-25

684 reads

Technical Article

Re-create Transaction log file

  • Script

This stored procedure detaches and re-attaches a database without specifying a filename for the transaction log. This causes SQL Server to create log file with default size of 512kb.After playing around with SHRINKDATABASE, SHRINKFILE, forcing the virtual log to wrap around, etc... I found this was the quickest and most reliable method of reclaiming the […]

You rated this post out of 5. Change rating

2002-02-25

2,608 reads

Blogs

Replacing Images in PBIR Format Reports

By

With the PBIR format of Power BI reports, it’s much easier to make report...

Capturing Ideas for Blogs

By

As we close out the year, I decided to drop this post here and...

A New Word: Lilo

By

lilo– n. a friendship that can lie dormant for years only to pick right...

Read the latest Blogs

Forums

The Oldest Article

By Steve Jones - SSC Editor

Comments posted to this topic are about the item The Oldest Article

Happy New Year 2025

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Happy New Year 2025

Using a RETURN

By stevec883

How does this capture multiple values from a cursor, and put them into an...

Visit the forum

Question of the Day

The Oldest Article

What's the oldest article on SQL Server Central (take a guess)?

See possible answers