# \#length-in-sql

**URL:** https://forum.devtalk.com/tag/length-in-sql/2806.md

[Latest](https://forum.devtalk.com/latest.md) · [Categories](https://forum.devtalk.com/categories.md) · [Tags](https://forum.devtalk.com/tags.md)

---

## [Declaring length in sql server](https://forum.devtalk.com/t/declaring-length-in-sql-server/75619)

<div class="topic-metadata">

**Author:** [@sona11](https://forum.devtalk.com/u/sona11)\
**Replies:** 0\
**Last updated:** [27 September 2022 06:48 UTC](https://forum.devtalk.com/t/declaring-length-in-sql-server/75619 "2022-09-27T06:48:03Z")

</div>

I want to declare max of length in case condition i.e 7 but getting a syntax error near select in this code. DECLARE @SQ Int(MAX) SELECT @SQ= MAX(LEN(FIRST\_NAME)) FROM #table SELECT @SQ -- 7 DROP TABLE #T SELECT CAS…
