可以从另一个表的字段中为值命名表

时间:2018-02-05 18:02:31

标签: sql sql-server

是否可以根据不同表的列中的值来命名表。

示例

Select a from dbo.[(select x of dbo.food where x=Candy)]

其他表:dbo.Food

  X      Y       Z 
--------------------
Candy  Apples  Pears
--------------------

我正在尝试将另一个表中的值附加为新表dbo.candy

2 个答案:

答案 0 :(得分:0)

我想,您正在寻找select into

SELECT * INTO dbo.candy
FROM dbo.food;
WHERE x = 'Candy';

答案 1 :(得分:0)

您可以将// Check if the user entered a new channel. if (member.voiceChannelID) { const newChannel = member.guild.channels.get(member.voiceChannelID); // If the user entered a game channel (prefixed with a game controller unicode emoji), group them into their own channel. if (newChannel.name.startsWith(String.fromCodePoint('0x1F3AE'))) { newChannel.clone(String.fromCodePoint('0x2501') + member.user.username + "'s Room", false) .then(createdChannel => { createdChannel.edit({ bitrate: 96000, //position: newChannel.position + 0, userLimit: 5, parent: '409821646698971136' }) //Set Permissions .then(createdChannel.overwritePermissions(member.user.id,{'MANAGE_PERMISSIONS':true, 'MANAGE_CHANNELS':true})) .then(createdChannel => { member.setVoiceChannel(createdChannel) .then(console.log('[' + new Date().toISOString() + '] Moved user "' + member.user.username + '#' + member.user.discriminator + '" (' + member.user.id + ') to ' + createdChannel.type + ' channel "' + createdChannel.name + '" (' + createdChannel.id + ') at position ' + createdChannel.position)) .catch(console.error); }) .catch(console.error); }) .catch(console.error); } } 与输出参数一起使用,如下所示:

sp_executesql