Majid Mohammadian (Mo***********@yahoo.com) writes:
I want declare an array of int in SQL Server
please help me to convert the following code from VB to TSQL
------------
Dim md_mon(12) As Integer
md_mon(1) = 31
-------------
SQL and Visual Basic are languages that work from very different mindsets,
and for a successful rewrite from VB to SQL it is often best to start from
the beginning. In VB you would typically to things in loops, to iterate
over items in a set of data, but in SQL you should always strive to use
commands that operate on the entire set at the same time. That is when
you actually win performance.
SQL does not have arrays, but there are tables, and tables are a lot broader
concept than array. So in this case:
CREATE TABLE md_mon (monthno int NOT NULL PRIMARY KEY,
noofdays tinyint NOT NULL)
--
Erland Sommarskog, SQL Server MVP,
es****@sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp