I'm having a strange problem with a query that I hope someone may have seen before. I've declared a variable @statvar as type int and @cmd1 as a varchar (255).
The statement where I'm having the problem is as follows:
set @cmd1='select @statvar=count(*) from '+@dbname+'..sysfiles'
I keep getting the error "Must declare the variable @statvar"
I've worked around the problem by eliminating the '@statvar= ' and sending the results to a temp table instead, but I'm curious as to why the original query doesn't work. I don't have any 'go' statements prior to it.
Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.
When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful.
Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables.
Make a table:
Update a specific column given a specific row using the UPDATE statement:
Remove a set of values using the DELETE s…