All Questions
Tagged with variable-declaration sql-server
9 questions
-2
votes
1
answer
42
views
Must declare the scalar variable when updating my database
my code:
SqlConnection con = new SqlConnection(@"DATA;");
SqlDataAdapter cmd = new SqlDataAdapter();
cmd.InsertCommand = new SqlCommand(" UPDATE TIME ...
0
votes
1
answer
71
views
SQL Order by clause affected when assigned value during operation
I'm using SQL Server and have a Users table with these columns:
Sr. (int), civil_id (varchar), fname etc
What I'm trying to achieve is an ordered insertion of civil_id in my user table say 100,101,...
0
votes
4
answers
98
views
How can I solve this query in sql server?
Sql Fiddle example
I have this table structure:
CREATE TABLE IF NOT EXISTS `client` (
`id` int(6) unsigned NOT NULL,
`name` varchar(200),
`balance` decimal NOT NULL,
PRIMARY KEY (`id`)
) ...
1
vote
1
answer
1k
views
SQL Server - "must declare scalar variable" error message even though I have just declared it
I am trying to write a script in SQL Server 2014 that imports a series of files where the date is in the file name. I will run this every day, with daily exports that have the respective date in their ...
0
votes
1
answer
295
views
Stored Procedure with local and input variables
I am trying to create a procedure that I can specify 2 input variables and have a number of local procedure variables that will return a SQL query results table.
This is the code that I have written ...
2
votes
1
answer
1k
views
MSSQL NVARCHAR(MAX) as Procedure Parameter and Variable Declaration Disadvantages
The question here is simple but although i have searched a lot, i haven't found an answer on the internet..
Is there any disadvantages using nvarchar(max) comparing with nvarchar(n) in procedure ...
2
votes
1
answer
3k
views
How to check if a sql variable is declared?
In MS SQL Server. Please don't tell me to ctrl-f. I don't have access to the entire query, but I'm composing the columns that depend on whether certain variable is declared.
Thanks.
Edit:
I'm ...
1
vote
3
answers
7k
views
Must declare the scalar variable "@varname" in database creation script
I'm trying to create a script for basic database and login/user creation for SqlServer
When i run my script I get many errors like:
Must declare the scalar variable "@varname"
when the variable is ...
-1
votes
1
answer
2k
views
i get an error when creating a variable and specifing the collation in sql server 2005
when i tried this:
DECLARE @var nvarchar(500) collate Arabic_BIN
i got that:
Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'collate'.
that is the full code, it works, i do not ...