TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ganesh babu
NA
40
3k
How to search grid view using date column?
Apr 26 2019 8:51 AM
In a SQL Server database, I have a table Priority with 3 columns id, name and registered date. For registered date, default value is getdate()which automatically generates the record created date and time. Now in grid view, I want to search records using this registered date.In grid view, I have dropdown search by using name and date.
CREATE
PROCEDURE
[dbo].[SEARCHPRIOR]
@SearchBy
VARCHAR
(50),
@SearchVal
VARCHAR
(50),
AS
BEGIN
IF @SearchBy =
'1'
BEGIN
SELECT
*
FROM
PRIORITY
WHERE
P_NAME
LIKE
'%'
+ @SearchVal +
'%'
END
ELSE
IF @SearchBy =
'2'
BEGIN
SELECT
*
FROM
PRIORITY
WHERE
P_TS
LIKE
'%'
+ @SearchVal +
'%'
END
ELSE
BEGIN
SELECT
*
FROM
PRIORITY
END
END
I have tried searching with this query but getting no results found in grid view. This is how table look like in SQL Server:
P_ID P_NAME P_TS
-------------------------------------------
1
High
2019
-
04
-
23 16
:
17
:
08.097
2
Medium
2019
-
04
-
24 16
:
17
:
23.070
3
Low
2019
-
04
-
25 16
:
17
:
32.420
Reply
Answers (
4
)
How can i Add row No ?
String_Agg is duplicating its values ...Please Help