# Connect to a SQL Server Database

Cognex Designer supports the option of connecting to a Microsoft® SQL Server® database (SQL Server 2008 R2 and later), which can be running locally or on another PC on the network. However, Designer does not support modifying (e.g. add/remove/edit tables) the database structure within the Designer development environment. Therefore, Cognex recommends that the database table be created and edited in Microsoft® SQL Server® 2012 Management Studio or later.

To create a connection to a SQL Server database, right-click on the Databases node in the Project Explorer and select New Database Connection.

Note:

- Designer only supports a sub-set of data types: bigint, binarybit, char, date, datetime, datetime2*, datetimeoffset, float, int, nchar, ntext, nvarchar, real, smalldatetime, smallint, text, tinyint, uniqueidentifier, varbinary, varchar.

  These data types are contained in a whitelist of supported fields (if a data type is not in the whitelist, it is not supported). When utilizing a SQL Server database, Cognex recommends that the account(s) connecting to the database be granted explicit permissions to just the tables needed for the application, and those tables only contain the data types contained in the whitelist.

  *datetime2 values may lose precision when being read and written to by Designer.

- Designer does not support the decimal, geography, hirachyid, image, money, numeric, smallmoney , sql_variant, time, timestamp and xml any other data type that is not contained in the whitelist. When creating a database, ensure that these types are not used for columns, otherwise Designer will be unable to connect to the database.