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
Download and play .puz crossword puzzles in Emacs.
Includes a browser to view puzzles’ detailed metadata, including progress of partially...
New
https://vimgifs-544mvq4w0-mraza007.vercel.app/
This thread was posted by one of our members via one of our news source trackers.
New
Once, there was a civilization (the Lisp Machine world) a lot like ours, but more advanced, with greater powers (like symbolic computatio...
New
Goodwill Strikes Again
A symptom of heavy Vim usage is that your brain begins to re-partition old memories for keyboard shortcuts— trashi...
New
This article is the fifth of the series aimed to teach Vim from the ground up:
Vim from the ground up
Vim for Beginners
Vim for Interm...
New
Why?
Why create Slate? Well… (Beware: this section has a few of my opinions!)
Before creating Slate, I tried a lot of the other rich tex...
New
Nova.
The beautiful, fast, flexible, native Mac code editor from Panic.
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
In 2021 I found a huge memory leak in VS code, totalling around 64 GB when I first saw it, but with no actual limit on how high it could ...
New
Other popular topics
I know that these benchmarks might not be the exact picture of real-world scenario, but still I expect a Rust web framework performing a ...
New
I am thinking in building or buy a desktop computer for programing, both professionally and on my free time, and my choice of OS is Linux...
New
New
Curious to know which languages and frameworks you’re all thinking about learning next :upside_down_face:
Perhaps if there’s enough peop...
New
Continuing the discussion from Thinking about learning Crystal, let’s discuss - I was wondering which languages don’t GC - maybe we can c...
New
Was just curious to see if any were around, found this one:
I got 51/100:
Not sure if it was meant to buy I am sure at times the b...
New
Author Spotlight
Jamis Buck
@jamis
This month, we have the pleasure of spotlighting author Jamis Buck, who has written Mazes for Prog...
New
Author Spotlight
Rebecca Skinner
@RebeccaSkinner
Welcome to our latest author spotlight, where we sit down with Rebecca Skinner, auth...
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
Ok, well here are some thoughts and opinions on some of the ergonomic keyboards I have, I guess like mini review of each that I use enoug...
New
Categories:
Sub Categories:
- All
- In The News (10452)
- 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
- /js
- /rails
- /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
- /deepseek
- /zig
- /scala
- /sublime-text
- /textmate
- /lisp
- /react-native
- /nixos
- /debian
- /agda
- /kubuntu
- /arch-linux
- /deno
- /django
- /ubuntu
- /revery
- /spring
- /manjaro
- /nodejs
- /diversity
- /lua
- /julia
- /slackware
- /c







