# current server & database

**URL:** <https://www.dynamicsuser.net/t/current-server-database/5143>\
**Category:** Developers Forum\
**Created:** [June 29, 2001, 12:39pm UTC](https://www.dynamicsuser.net/t/current-server-database/5143 "2001-06-29T12:39:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlexanderS](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@AlexanderS](https://www.dynamicsuser.net/u/AlexanderS)\
**Post date:** [June 29, 2001, 12:39pm UTC](https://www.dynamicsuser.net/t/current-server-database/5143/1 "2001-06-29T12:39:07Z")

</div>

How to get CURRENT server and database name in MSSQL Server Option for NF? Thanks.

---

<div class="post-metadata">

**Author:** ![robertc](https://avatars.discourse-cdn.com/v4/letter/r/da6949/32.png) [@robertc](https://www.dynamicsuser.net/u/robertc)\
**Post date:** [July 31, 2001, 11:25am UTC](https://www.dynamicsuser.net/t/current-server-database/5143/2 "2001-07-31T11:25:46Z")

</div>

No easy way, unfortunately, without creating a linked object. Create a SQL view in your database:

```auto

CREATE VIEW [ServerAndDatabase] AS
SELECT CAST(@@SERVERNAME AS NVARCHAR(128)) AS [Server Name], [Database Name]
FROM Session
WHERE [My Session] = 1

```

Create a C/SIDE table with the same table and field names (both Text128), with DataPerCompany = No. Save the table and you can use its single record to obtain the server and database.
