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
In 2018 Bryan Cantrill gave a brilliant talk where he shared his recent experiences with the Rust programming language. More profoundly, ...
New
Download and play .puz crossword puzzles in Emacs.
Includes a browser to view puzzles’ detailed metadata, including progress of partially...
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
Once, there was a civilization (the Lisp Machine world) a lot like ours, but more advanced, with greater powers (like symbolic computatio...
New
At Replit, we want to give our users the most powerful, flexible, and easy-to-get-started coding environment. However, it has been limiti...
New
Here’s my (current) minimal setup:
set ai nocp digraph ek hid ru sc vb wmnu noeb noet nosol
set bs=2 fo=cqrt ls=2 shm=at tw=72 ww=&l...
New
This was interesting:
He’s definitely more of an Emacs fan (which is fine) and the thing I found interesting is how you wo...
New
I’m trying it out tonight. Any tips or experiences?
I’ve actually had quite a bit of success with chatting with GPT-4, at least until it...
New
Other popular topics
Ruby, Io, Prolog, Scala, Erlang, Clojure, Haskell. With Seven Languages in Seven Weeks, by Bruce A. Tate, you’ll go beyond the syntax—and...
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
In case anyone else is wondering why Ruby 3 doesn’t show when you do asdf list-all ruby :man_facepalming: do this first:
asdf plugin-upd...
New
Intensively researching Erlang books and additional resources on it, I have found that the topic of using Regular Expressions is either c...
New
Use WebRTC to build web applications that stream media and data in real time directly from one user to another, all in the browser.
...
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
Rails 7 completely redefines what it means to produce fantastic user experiences and provides a way to achieve all the benefits of single...
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
Author Spotlight
Erin Dees
@undees
Welcome to our new author spotlight! We had the pleasure of chatting with Erin Dees, co-author of ...
New
If you’re getting errors like this:
psql: error: connection to server on socket “/tmp/.s.PGSQL.5432” failed: No such file or directory ...
New
Categories:
Sub Categories:
- All
- In The News (10448)
- 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
- /html
- /opensuse
- /centos
- /php
- /deepseek
- /zig
- /scala
- /lisp
- /sublime-text
- /textmate
- /react-native
- /nixos
- /debian
- /agda
- /kubuntu
- /arch-linux
- /django
- /deno
- /revery
- /ubuntu
- /spring
- /nodejs
- /manjaro
- /diversity
- /lua
- /julia
- /c
- /slackware







