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
Makinde A. Israel
1.6k
168
21k
DbMigration: How to use IF EXISTS in SQL()
Mar 12 2019 3:25 AM
Please I have a web App with lots of migrations. I need to drop an index first if it exist before creating it. In the Dbmigration method. I used DropIndex("[Log]", "[IX_ContentL]") But it throws error, the specified index does not exist. So I tried to first check if the index exist or not using Sql(" IF EXISTS(SELECT * FROM sys.indexes WHERE name=[IX_ContentL] AND object_Id = [dbo].[Log]) DROP INDEX ([IX_ContentL]);"); But it throws an unable to parse statement error with the following information. [Token Line 1, Token offset 1, Token error IF] Please help me, I've been on this 3 days now. I've tried different combination as suggested on different blogs. It seems the Sql() function does not recognize the IF EXISTS statement. Please I need help. Thanks.
Reply
Answers (
3
)
sir,i create SP but it show only 1 table in CR
how to compare and calculate current date with db’s date ?