Showing posts with label sql server. Show all posts
Showing posts with label sql server. Show all posts

Tuesday, 17 May 2011

Sql server column and stored procedure data types

Given a table with a column 'postcode' (for example) taking data type 'varchar(20)' and a stored procedure taking parameter '@postcode' of type 'varchar(max)'. Passing a string of length larger than 20 will throw up an exception.

On the other hand, given a table with a column 'postcode' taking data type 'varchar(20)' and a stored procedure taking parameter '@postcode' of type 'varchar(20)'. Passing a string of length larger than 20 will truncate and insert the string no problem.