Using SQL Server 2005
I want to insert a table with where condition
Table1 column Name -开发者_运维技巧 ID, Name, Dept, Rank
Query
Insert into table1 values('1', 'Raja' 'IT', 'True') where Rank <> 'False'
Need Query Help
insert into table 1 select '1', 'raja', 'it', 'true' from SomePlaceWhereRankExists where rank <> 'false'
It's not clear where 'Rank' is coming from in your pseudo code.
Perhaps you're attempting something along the lines of:
IF @rank <> 'false'
Insert into table1 values('1', 'Raja' 'IT', 'True')
You're not particularly clear about your goal however. Are you trying to update existing records or insert new ones? If you're inserting new ones, what are you trying to achieve using a where clause?
精彩评论