sona11
Declaring length in sql server
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 CASE WHEN LEN(SEQ_NUM) = 0 THEN NULL ELSE SEQ_NUM END AS REC_NUM,
CASE WHEN LEN(FIRST_NAME) = 0 THEN NULL ELSE CONVERT(CHAR(SELECT @SQ= MAX(LEN(FIRST_NAME))
FROM #table),RTRIM(UPPER(FIRST_NAME))) END AS FIRST_NAME
INTO #T
FROM #table
--== Need 7 Char(7) -- Max of len
DROP TABLE #T
SELECT CASE WHEN LEN(SEQ_NUM) = 0 THEN NULL ELSE SEQ_NUM END AS REC_NUM,
CASE WHEN LEN(FIRST_NAME) = 0 THEN NULL ELSE CONVERT(CHAR(7),RTRIM(UPPER(FIRST_NAME))) END AS FIRST_NAME
INTO #T
FROM #table
I tried figuring it out and also went through this resource that has similar things but was still unable to find the solution. Can anyone help me out in finding the solution? Thank you.
Popular General Dev topics
New
Batteries included with Emacs.
Emacs has a reputation for being borderline unusable out of the box, of being bloated but somehow surpris...
New
At least one Vim trick you might not know • Hillel Wayne.
I’ve been using Vim for eight years and am still discovering new things. This...
New
Wheel is a navigation plugin for Vim and Neovim. It is buffer group oriented and makes abundant use of special buffers, in which you can ...
New
TL;DR: You want to teach yourself vim (the best text editor known to human kind) in the fastest way possible. This is my way of doing it....
New
You want VSCodium from my understanding then, it is VSCode with the telemetry removed. :slight_smile:
New
So, I actually got my Onivim License Key a while back.
Am a Vim user for about 4 years.
For me it was never ready enough for getting ac...
New
Neorg is a tool designed to reimagine organization as you know it. Neo - new, org - organization. Grab some coffee, start writing some no...
New
I installed Github Copilot (VS Code extension) and signed up for the technical preview three days ago. Yesterday I got the invitation, an...
New
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)
SELEC...
New
Other popular topics
Reading something? Working on something? Planning something? Changing jobs even!?
If you’re up for sharing, please let us know what you’...
New
Algorithms and data structures are much more than abstract concepts. Mastering them enables you to write code that runs faster and more e...
New
There’s a whole world of custom keycaps out there that I didn’t know existed!
Check out all of our Keycaps threads here:
https://forum....
New
The V Programming Language
Simple language for building maintainable programs
V is already mentioned couple of times in the forum, but I...
New
Author Spotlight
Dmitry Zinoviev
@aqsaqal
Today we’re putting our spotlight on Dmitry Zinoviev, author of Data Science Essentials in ...
New
I have always used antique keyboards like Cherry MX 1800 or Cherry MX 8100 and almost always have modified the switches in some way, like...
New
Develop, deploy, and debug BEAM applications using BEAMOps: a new paradigm that focuses on scalability, fault tolerance, and owning each ...
New
Get the comprehensive, insider information you need for Rails 8 with the new edition of this award-winning classic.
Sam Ruby @rubys
...
New
Hello,
I’m a beginner in Android development and I’m facing an issue with my project setup. In my build.gradle.kts file, I have the foll...
New
Explore the power of Ash Framework by modeling and building the domain for a real-world web application.
Rebecca Le @sevenseacat and ...
New
Categories:
Sub Categories:
- All
- In The News (10408)
- Dev Chat (202)
- Questions (34)
- Resources (119)
- Blogs/Talks (27)
- Jobs (3)
- Events (15)
- Code Editors
- Hardware (57)
- Reviews (5)
- Sales (16)
- Design & UX (5)
- Marketing & SEO (2)
- Industry & Culture (14)
- Ethics & Privacy (19)
- Business (4)
- Learning Methods (5)
- Content Creators (7)
- DevOps & Hosting (9)
Popular Portals
- /elixir
- /rust
- /ruby
- /wasm
- /erlang
- /phoenix
- /keyboards
- /python
- /rails
- /js
- /security
- /go
- /swift
- /vim
- /clojure
- /emacs
- /haskell
- /java
- /svelte
- /onivim
- /typescript
- /kotlin
- /c-plus-plus
- /crystal
- /tailwind
- /react
- /gleam
- /ocaml
- /flutter
- /elm
- /vscode
- /ash
- /opensuse
- /html
- /centos
- /php
- /zig
- /deepseek
- /scala
- /textmate
- /sublime-text
- /lisp
- /react-native
- /nixos
- /debian
- /agda
- /kubuntu
- /arch-linux
- /django
- /deno
- /revery
- /ubuntu
- /manjaro
- /nodejs
- /spring
- /diversity
- /lua
- /julia
- /c
- /slackware






