Miscellaneous

SQLServerCentral Article

Use ISO Images Without Burning to Disk

  • Article

Many downloads - especially from MS - are now coming as ISO images. Usually you burn these to CD or DVD and then use as normal, but there is a way to access the image directly saving the time/cost of burning. Not a SQL article, but you may find it useful anyway.

4.5 (2)

You rated this post out of 5. Change rating

2005-10-14 (first published: )

55,497 reads

Technical Article

usp_exec_tsql_strfile

  • Script

Executes a file containing T-SQL code without using OSQL. The file can be up to 80,000 characters. Each line in the file should be no more than 256 characters. (Customize the code as needed.) The DOS Type command is used to retrieve the code. Embedded "go"s are removed so don't expect termination behavior. The only […]

You rated this post out of 5. Change rating

2005-03-25 (first published: )

536 reads

SQLServerCentral Article

Is all code really code? One question from an interview

  • Article

Andy discusses one of the questions he uses to screen senior developer candidates. While the question itself is interesting, we think it will be more interesting to see how many of you agree with one of his positions - that developers think of program code and sql code as different animals, especially when it comes to debugging.

You rated this post out of 5. Change rating

2004-07-09

11,912 reads

Technical Article

Change Result Set Columns to Rows

  • Script

I had a developer in my company come to me recently with a unique request.  He asked if there was any way for sql to return a result set that was flopped.  In other words he wanted the rows to be columns and the columns to be rows.  So that a result set like this:Col1    […]

You rated this post out of 5. Change rating

2004-07-19 (first published: )

349 reads

Technical Article

Remove Duplicates from Table - No Cursors

  • Script

This script deletes all duplicates from a table.  It keeps the first instance of the record, and discards all others.  If you want to keep the last instance of the record, use MAX instead of MIN.  The script can be modified very easily to include more/less fields for comparison.  I've successfully used this SP to […]

You rated this post out of 5. Change rating

2004-07-27 (first published: )

296 reads

Technical Article

BulkExport - export data from TSQL

  • Script

sp_BulkExport:Export Data from TSQL without using xp_cmdshell - uses SQLDMO and sp_OA*.  Supports a variety of formats and options.  In my testing on a 22 million-row table it is NOT as fast as BCP.  This is the first rev of the proc and it has not been thoroughly tested.

You rated this post out of 5. Change rating

2004-09-16 (first published: )

934 reads

Technical Article

FormatDate - Mimics the VB Format routine for date

  • Script

I don't remember where I found this little gem, but as a VB Developer it has simplified retrieving  dates on many projects. Simply pass the function a datetime value and the format that you want in VB style syntax and the date is properly returned. I have modified it slightly from the original author (who […]

5 (2)

You rated this post out of 5. Change rating

2004-07-23 (first published: )

303 reads

Technical Article

SQLCalcEngine - evaluate numeric expression

  • Script

SQLCalcEngine - evaluate numeric expression similar to the VB eval function.The basic concept is to pass a string containing a numeric expression such as ((2+3)*(4/9)) and receive a numeric value back. The algorithm is based loosely on material found at http://www.arstdesign.com/articles/expression_evaluation.html, as well as material found in the book "Writing Compilers and Interpreters" by Ronald […]

You rated this post out of 5. Change rating

2005-03-31 (first published: )

318 reads

Blogs

The CDO’s Playbook for AI Driven Decision Making

By

The New Arena of Leadership The role of the Chief Data Officer is no...

sp_snapshot – The easy way to take database snapshots of one or more databases – V3.0

By

Presenting you with an updated version of our sp_snapshot procedure, allowing you to easily...

SELECT *

By

SELECT * feels convenient, but in SQL Server it bloats I/O, burns network bandwidth,...

Read the latest Blogs

Forums

Recursive Select - What is this really doing

By Leo.Miller

I've noticed several instances of what looks like a recursive insert with the format:...

Cleaning Up the Cloud

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Cleaning Up the Cloud

The Maximum Value in the Identity Column

By Steve Jones - SSC Editor

Comments posted to this topic are about the item The Maximum Value in the...

Visit the forum

Question of the Day

The Maximum Value in the Identity Column

I have a table with this data:

TravelLogID CityID StartDate  EndDate
1           1      2025-01-01 2025-01-06
2           2      2025-01-01 2025-01-06
3           3      2025-01-01 2025-01-06
4           4      2025-01-01 2025-01-06
5           5      2025-01-01 2025-01-06
I run this code:
SELECT IDENT_CURRENT('TravelLog')
I get the value 5 back. Now I do this:
SET IDENTITY_INSERT dbo.TravelLog ON
INSERT dbo.TravelLog
(
    TravelLogID,
CityID,
    StartDate,
    EndDate
)
VALUES
(25, 5, '2025-09-12', '2025-09-17')
SET IDENTITY_INSERT dbo.TravelLog OFF
I now run this code.
DBCC CHECKIDENT(TravelLog)
GO
INSERT dbo.TravelLog
(
    CityID,
    StartDate,
    EndDate
)
VALUES
(4, '2025-10-14', '2025-10-17')
GO
What is the value for TravelLogID for the row I inserted for CityID 4 and dates starting on 14 Oct 2025?  

See possible answers