Avatar of banu111
banu111

asked on 

SQL query search

HI friends
I have function  GetValue( string id)
I am passing id=abcd
I want to assign to a variable  if abcd is present in the databse
but abcd   is stored as abcd@MCKTESTAD.local
in database. I want to search the database exactly the row which contains
id@(abcd )  in the beginning and  assign that value to variable. How can I do that
Application ServersC#Microsoft SQL Server

Avatar of undefined
Last Comment
banu111
ASKER CERTIFIED SOLUTION
Avatar of Aneesh
Aneesh
Flag of Canada image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Anuradha Goli
Anuradha Goli
Flag of Ireland image

To get data from SQL Server which matches string starts with ''id@(abcd )' is:

Declare @data nvarchar(50)
set @data = 'abcd@MCKTESTAD.local'
SELECT * FROM TableA WHERE COLUMN1 LIKE 'id@(abcd )%'

Open in new window

Avatar of Aneesh
Aneesh
Flag of Canada image

You should probably change your Grading strategy. I hope i gave you the perfect answer.
Avatar of banu111
banu111

ASKER

but if have two users abcd@MCKTESTAD.local and abcd@MCKTESTAD.local will it wrk
Avatar of banu111
banu111

ASKER

sry abcd1@MCKTESTAD.local
Microsoft SQL Server
Microsoft SQL Server

Microsoft SQL Server is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.SQL Server is available in multiple versions, typically identified by release year, and versions are subdivided into editions to distinguish between product functionality. Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning.

171K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo