Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
CoolMoon2011
Starting Member
31 Posts |
Posted - 2012-01-12 : 12:16:41
|
| how to insert one extral row into my tables I have the table with two columns, like this:Runtype groupfieldI want to insert one row, runtype= Good , groupfiled= G + '_' + case when [iss-year] < 2007 then ''O'' else ''N'' end + ''_'' + cast(company as varchar(2)),finally the table looks like thisRuntype groupfieldGood G + '_' + case when [iss-year] < 2007 then ''O'' else ''N'' end + ''_'' + cast(company as varchar(2)),I will use the groupfield for a @string laterlike Select @string1='groupdfield' |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-01-12 : 12:26:10
|
| [code]insert into table (Runtype, groupfield)values('Good','G + ''_'' + case when [iss-year] < 2007 then ''O'' else ''N'' end + ''_'' + cast(company as varchar(2)),')[/code]i dont think its a good approach to store query part like this. Can i ask reason for this?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-01-12 : 12:55:52
|
| why should you take it as value at run time and then form query and execute? where do you get these code snippets from?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|