Jump to content

ironcurtain

Members
  • Posts

    5
  • Joined

  • Last visited

ironcurtain's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. I founded solution for above: declare @filepath varchar(50)set @filepath = 'e:\tsql\'declare @filetype varchar(5)set @filetype = 'txt'declare @commamd varchar(50)set @commamd = 'dir /b '+@filepath+@filetypecreate table #tab1 (name varchar(100))insert #tab1 exec master..xp_cmdshell @command
  2. While trying to run below query I got error: Incorrect syntax near '+'. declare @filepath varchar(50)set @filepath = 'e:\tsql\'create table #tab1 (name varchar(100))insert #tab1 exec master..xp_cmdshell 'dir /b "'+@filepath'"+"'*.txt'"' I think there is issue with quatation marks but I couldn't find any solution. Please help.
  3. I thought that maby there is some solution similar to "servers.servername like history.serverName" or there is possibility to cut of the last character in serverName.Anyway thank You for the reply.
  4. Hi Everyone, I have two tables: table1: history dayid nofile servername11082012 1 server112082012 1 server213082012 1 server314082012 1 server1* table2 servers: serverName unitserver1 emeaserver2 uaeserver3 emea I wrote a querry to join tables: select history.dayid, history.nofile, history.servername, servers.unitfrom historyleft joinserversonhistory.servername = servers.serverName In my case server1* is the same as server1but SQL see that as a different names. Is there a possibility to join the tables without empty cells?I'd like to avoid creating temporary tables. Thank You for answering my question.
×
×
  • Create New...