
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

Thanks to @foxtrottwist’s and @Tomas’s posts in this thread: Poll: Which code editor do you use? I bought Onivim! :nerd_face:
https://on...
New

Batteries included with Emacs.
Emacs has a reputation for being borderline unusable out of the box, of being bloated but somehow surpris...
New

What you need to know before try Emacs.
When it comes to Emacs, every programmer should have heard its name more or less. After all, Ema...
New

Please share your favourite Vim tips here :nerd_face:
New
New

Welcome to the second part of this series aimed to make you a better Vim user! If you have no idea about Vim, you should begin with the f...
New

Download and play .puz crossword puzzles in Emacs.
Includes a browser to view puzzles’ detailed metadata, including progress of partially...
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

It’s Magit! A Git interface inside Emacs
Magit is a text-based Git user interface that puts an unmatched focus on streamlining workflows....
New

Vim 9.0 released
After many years of gradual improvement Vim now takes a big step with a major release. Besides many small additions the ...
New
Other popular topics

Any thoughts on Svelte?
Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue...
New

Which, if any, games do you play? On what platform?
I just bought (and completed) Minecraft Dungeons for my Nintendo Switch. Other than ...
New

You might be thinking we should just ask who’s not using VSCode :joy: however there are some new additions in the space that might give V...
New

My first contact with Erlang was about 2 years ago when I used RabbitMQ, which is written in Erlang, for my job. This made me curious and...
New

If you are experiencing Rails console using 100% CPU on your dev machine, then updating your development and test gems might fix the issu...
New

This is going to be a long an frequently posted thread.
While talking to a friend of mine who has taken data structure and algorithm cou...
New

I am trying to crate a game for the Nintendo switch, I wanted to use Java as I am comfortable with that programming language. Can you use...
New

Author Spotlight
Rebecca Skinner
@RebeccaSkinner
Welcome to our latest author spotlight, where we sit down with Rebecca Skinner, auth...
New

If you want a quick and easy way to block any website on your Mac using Little Snitch simply…
File > New Rule:
And select Deny, O...
New

Inside our android webview app, we are trying to paste the copied content from another app eg (notes) using navigator.clipboard.readtext ...
New
Categories:
Sub Categories:
- All
- In The News (10003)
- Dev Chat (200)
- Questions (30)
- Resources (118)
- Blogs/Talks (26)
- Jobs (3)
- Events (14)
- Code Editors
- Hardware (57)
- Reviews (4)
- Sales (15)
- Design & UX (4)
- Marketing & SEO (1)
- Industry & Culture (14)
- Ethics & Privacy (19)
- Business (4)
- Learning Methods (4)
- Content Creators (7)
- DevOps & Hosting (9)
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /rails
- /js
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /java
- /haskell
- /emacs
- /svelte
- /onivim
- /typescript
- /crystal
- /c-plus-plus
- /tailwind
- /kotlin
- /gleam
- /react
- /flutter
- /elm
- /ocaml
- /ash
- /vscode
- /opensuse
- /centos
- /php
- /deepseek
- /scala
- /html
- /zig
- /debian
- /nixos
- /lisp
- /agda
- /textmate
- /sublime-text
- /react-native
- /kubuntu
- /arch-linux
- /revery
- /ubuntu
- /manjaro
- /django
- /spring
- /diversity
- /lua
- /nodejs
- /julia
- /slackware
- /c
- /neovim