开发者

Inserting a values with condition

开发者 https://www.devze.com 2022-12-21 07:16 出处:网络
Using SQL Server 2005 I want to insert a table with where condition Table1 column Name -开发者_运维技巧 ID, Name, Dept, Rank

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消