what is good, explicite cursor in backend or loop in front end?

what is good,using explicite cursor,while loop on database side OR using loop on front end (application side programm)??? Edited:- Hi,if I want to iterate and i am using ado.net asynchronous(disconnected) connection (ie.I have a datatable and i am applying for loop on datatable in front end) — In this case,If i want to iterate which […]

How to increase my Web Application's Performance?

I have a ASP.NET web application (.NET 2008) using MS SQL server 2005. I want to increase the performance of the web site. Does anyone know of an article containing steps to do that, step by step, in SQL (indexes, etc.), and in the code?

Error message when executing stored procedure that creates table

alter procedure SP_employeedetails ( @tablename varchar(50), @empname varchar(50), @age int, @address varchar (50) ) as begin declare @xxx varchar(50) set @xxx= ‘create table ‘+@tablename+’ ( ‘+@empname+’varchar(50), ‘+@age+’ int , ‘+@address+’ varchar(50) )’ print @xxx exec (@xxx) end When I excecuted this using the statement exec SP_employeedetails ‘Employeedetails’, ‘jhon’, 25, ‘cochin’ following error message was displayed […]

Dynamically querying a table with a variable name yields a vague “Incorrect syntax near 'Select'” Error

I’m trying to query the top 5 rows in an existing table with a dynamically generated name. I understand that many on SO have had problems/questions doing something similar, and I’ve read through a handful of solutions, but all to no avail. I can generate the table name just fine; the issue is then taking […]

TSQL Equal or Not Equal conditional in Where clause

Based on a declared variable, is it possible to switch between not equal and equal in the where clause? For example, if the variable @InState is set to true, then return all the addresses with a state equal to ‘CA’, if false, return all of the addresses with states <> ‘CA’. Code: DECLARE @InState bit […]

SQL Server Incorrect syntax near '(' in recursive query

I am trying to convert a IBM db2 query to a SQL Server query. I am not very familiar with WITH AS construct. The db2 query (which works) is: with ZoneList (id, name, parent_name, parent_id, level) as (select id, name, ”, parent_id, 1 as level from products.zones where id = 1 union all select z.id, […]

is there any inbuilt function in sql to implement following operation

I have table like this column1 column2 column3 1 12 1 1 12 2 1 4 3 1 5 4 1 34 5 2 36 6 2 22 7 2 12 8 2 2 9 2 4 10 2 41 11 3 44 12 3 55 13 3 66 14 3 34 15 I need […]

sql server access ONLY the previous record based on a selection

Given the following table id short_name long_name category departure rec_order 1548 AAA AAA AA station 10:00 1 1548 BBB BBB BB station 11:10 2 1548 CCC CCC CC station 12:30 3 1548 DDD DDD DD border 15:30 4 I want to access only last the row (station) before the border. Basically return only CCC CCC […]

Store very large numbers in scientific notation form in SQL

We have an application which returns result of large calculations in exponent to base form like 1.8e+6. We need to save this value in database. Can we store this in database as integer or it should be converted to a number first ? please help

SQL replace syntax

I have a select query that gets a field and displays it with a custom name, ex acctID as ACCOUNT ID. If the data for this field is a varchar but is all numbers with decimals ex 000.887.4456.000000, how do I use replace in that select query to remove the decimals from a field like […]

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