Advertisement
Guest User

Untitled

a guest
May 30th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. DECLARE @advanced_options int
  2. DECLARE @xp_cmdshell int
  3.  
  4. --CONVERT ( data_type [ ( length ) ] , expression [ , style ] )
  5.  
  6. SELECT @advanced_options = value_in_use
  7. FROM sys.configurations
  8. WHERE name = 'show advanced options'
  9.  
  10. SELECT @xp_cmdshell = value_in_use
  11. FROM sys.configurations
  12. WHERE name = 'xp_cmdshell'
  13.  
  14. select @advanced_options as advOptions, @xp_cmdshell as cmdShell
  15.  
  16. exec sp_configure 'show advanced options', 1;
  17. Reconfigure;
  18.  
  19. EXEC sp_configure 'xp_CMDShell', 1;
  20. Reconfigure;
  21.  
  22. DECLARE @CMDSQL VARCHAR(1000)
  23. SET @CMDSQL = 'F:AdressFillDBWithMSTabFiles'--Keep in mind, path needs to be correct.
  24. EXEC master..xp_CMDShell @CMDSQL
  25.  
  26. EXEC sp_configure 'xp_CMDShell', @xp_cmdshell;
  27. Reconfigure;
  28.  
  29. exec sp_configure 'show advanced options', @advanced_options;
  30. Reconfigure;
  31.  
  32. select @advanced_options as advOptions, @xp_cmdshell as cmdShell
  33.  
  34. Msg 257, Level 16, State 3, Line 4
  35. Implicit conversion from data type sql_variant to int is not allowed. Use the CONVERT function to run this query.
  36. Msg 257, Level 16, State 3, Line 8
  37. Implicit conversion from data type sql_variant to int is not allowed. Use the CONVERT function to run this query.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement