Skip to main content

All Questions

Filter by
Sorted by
Tagged with
-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 ...
Dennys's user avatar
  • 3
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,...
Haseeb Raza's user avatar
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`) ) ...
Esraa_92's user avatar
  • 1,568
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 ...
Matt G's user avatar
  • 77
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 ...
Lucas Perrett's user avatar
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 ...
adaskar's user avatar
  • 55
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 ...
ailerifren's user avatar
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 ...
giammin's user avatar
  • 19k
-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 ...
mostafa's user avatar