Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/340.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 用于更改多个不同表中具有不同名称的列的DB值的脚本_C#_Sql Server 2008 - Fatal编程技术网

C# 用于更改多个不同表中具有不同名称的列的DB值的脚本

C# 用于更改多个不同表中具有不同名称的列的DB值的脚本,c#,sql-server-2008,C#,Sql Server 2008,有点新的数据库脚本 我想要一个脚本,可以显示10列中的10列 用于将10列的值从10列更改为10列的脚本 我知道我可以使用Select语句,但这是最佳实践吗 编辑 我累了 Select table1.column1, table1.column2, table2.column1 ...... table100.column100 FROM table1,table2,.....table100; 但是得到这个错误 Msg 208,第16级,状态1,第1行无效的对象名称“

有点新的数据库脚本

  • 我想要一个脚本,可以显示10列中的10列
  • 用于将10列的值从10列更改为10列的脚本
  • 我知道我可以使用Select语句,但这是最佳实践吗

    编辑

    我累了

    Select
    
    table1.column1,
    table1.column2,
    table2.column1
        ......
        table100.column100 FROM    table1,table2,.....table100;
    
    但是得到这个错误

    Msg 208,第16级,状态1,第1行无效的对象名称“table1”

    回答

    没有几个表被错误地删除了

    1.Selecting 10's of columns from 10's of columns -- select * from tablename is good way.
    But this is not good when you consider the query for performance point of view.If your reuirement is to get all the columns of a table then you can use select * from tablename.
    
    2.This is quite obvious that you have to use all 10 columns if u have to change their values.
    UPDATE tablename SETcol1=value1,
           col1=value1,
           col1=value1,
           .....