Tag: stored-procedures

My stored procedure is vulnerable i think

I am running an ASP.NET MVC app on SQL Server which seems to have been hacked or SQL injected. The database keeps creating tons of new fake accounts daily, I haven’t fully identified the problem yet but I am worried about my stored procedure code which I previously thought was immune to SQL Injection. Below […]

Can many Users open a SP with a TempTable in it?

After a user is logged into his system and opens my progamm he can see data from a database depending on his WindowsUsername(I wrote a little stored procedure for that). This Data comes from a query with a temporary Table (#temp). My question is now, if many users use this programm, after opening it they […]

Struggling with a pivot query in SQL Server

I use a Linq-2-Sql at the moment in order to perform a fairly complicated query. It is however very inefficient and results in multiple round trips being made to the server. Using some joins I have managed to get the data into a format like this: Sensor — Timestamp — Value A — 12/02/2013 09:00 […]

How to call a stored procedure from MSSQL into grails

I have a stored procedure thats works, which selects depending on the where clause. However when i try to call it from my grails application i get error saying index 1 out of range. My code is as follows class SQLTestController { def dataSource def index() { Sql sql = new Sql(dataSource) def result = […]

Combining two stored procedures (select & update) into one

I’m wondering if anyone can help me in combining these two stored procs into one. CREATE PROCEDURE [dbo].[spGetMsgID] — Add the parameters for the stored procedure here @SendingF varchar(50), @SendingA varchar(50) AS BEGIN — SET NOCOUNT ON added to prevent extra result sets from — interfering with SELECT statements. SET NOCOUNT ON; SELECT Prefix, Counter […]

“Too many arguments specified” when execute INSERT stored procedure

I’m stuck with a stored procedure on MSSQL 2008 R2. It looks correct but when I execute this stored procedure, I got the error “too many arguments specified”. Here is SP code: ALTER PROCEDURE [dbo].[InsertOrder] @KodT int, @kodG int, @Ad int, @Chd int, @PU datetime, @disc money, @Agent int, @PriceAd money, @PriceCh money AS BEGIN […]

Dynamic Query is not working with cursor in SqlServer 2008 Stored Procedure

I am building a stored procedure in Sql Server 2008. Stored Procedure has two arguments which are the column names of a table. In stored procedure I used dynamic query for fetching data of these two columns with the help of Cursor. Code: Create PROCEDURE TestSP ( @firstAttribute nvarchar(max), @secondAttribute nvarchar(max) ) AS DECLARE @x […]

Convert Time In sql

hi in my table i have 3 column (name – from – to) and data type time(7) i insert 3 shift shift1 from 08:00:00 to 15:00:00 shift2 from 15:00:00 to 22:00:00 shift3 from 22:00:00 to 08:00:00 and i Has Create SP to check of what is shift now this is the SP create PROC SelectShift […]

Primary Identity Column of table gets random value in sql server 2012

This question already has an answer here: Identity increment is jumping in SQL Server database 6 answers

Stored Procedure in SQL Server 2008

I am trying to create a stored procedure but it is giving me an error while executing it. Msg 156, Level 15, State 1, Procedure SignupUser, Line 13 Incorrect syntax near the keyword ‘User’. My stored procedure is: CREATE PROCEDURE SignupUser ( @FirstName nvarchar(25), @LastName nvarchar(25), @Email nvarchar(50), @Password nvarchar(25), @Mobile nvarchar(20), @City nvarchar(25), @StateProvince […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.