sql-server

Preventing SQL Injection in SQL Server TEXT fields using Classic ASP

I've got code in ASP that puts values into a Text field in SQL Server using parameterized queries. I was wondering if parameterizing is enough, or if I have to search the field for potential commands, replacing single ticks with double ticks,etc. The text fields are essays, so they might have any number of words or characters. Am I safe...

Does ASP.net Report Viewer / Reports require Reporting Services on SQL server

I have an application that makes use of Report Viewer and Report (.rdlc) files. Does this mean that I need to have "Reporting Services" installed on my SQL server?? Also would not having "SQL Server Analysis services" affect me any way I want to make sure I keep using - SQL Server Profiler - SQL Server Agent - create and run manageme...

Suggestions for dynamic SQL Server access using C#

Hey guys, I'm looking for a good solution to make my life easier with regards to writing/reading to a SQL Server DB in a dynamic manner. I started with Entity-framework to make my life easier to begin with, but as the software become more general and config driven I'm finding that Entity becomes less and less appropriate because it reli...

Do I need to use multiple column SQL Server index in the same order as I declare it?

When I declare a clustered index, specifying: column1, column2 and column3 in this order - do I need to use the columns in that same order? For example, will this use the clustered index mentioned earlier to update multiple rows: UPDATE Table1 WHERE column3 = 1 AND column2 = 1 AND column1 = 1 ...

help with a sql query

(newbie, help if you can please) hi, i could use some help writing a SQL query. i'm trying to display some data from one table but the data i need depends on a value from a different table. i'm pretty new to this so i will try to explain this the best i can: i have an 'Orders' table with a 'ShipCity' and 'OrderId' columns. i would like...

Python vs C#/.NET -- what are the key differences to consider for using one to develop a large web application?

My organization currently delivers a web application primarily based on a SQL Server 2005/2008 back end, a framework of Java models/controllers, and ColdFusion-based views. We have decided to transition to a newer framework and after internal explorations and mini projects have narrowed the choice down to between Python and C#/.NET. Le...

Copy substring of one column and copy to another.

This is a bit above my level. But am trying to learn. I don't want to seem like I'm just trying to get my homework done but would appreciate any help pointers. I am trying to find a substring (postcode) in an address column and once found, copy to the post code column I have the following sql which finds columns that match a postcode pa...

Using Entity Framework as a database design tool?

One thing I like about the Entity Framework v4 is the fact you can design with a "model-first" approach. I'm also a big fan of the Visual Studio Database project for version controlling changes to the database schema. Traditionally I've been using SSMS tool to generate the schema, and then importing that into the database project. In o...

SQL Server 2005 where condition with string comparison

I am using SQL Server 2005 with the following query SELECT * FROM EMPLOYEE WHERE EMP_NAME = 'ABCD' It gave me the proper results and when i tried the same query with 'ABCD ', then also it gave me the same result!!! I feel it should not give any results as there is no employee with name 'ABCD ' Or "WHERE" condition works like thi...

No MSDTC - Still getting "communication with underlying transaction manager failed"

Hi In my project I am using Ado.Net's DbTransaction object to manage transaction... Then why I am getting MSDTC related error - "communication with underlying transaction manager failed". Here is my code. DbTransaction trans = Connection.BeginTransaction(); //Code if (successfull) { trans.Commit(); } else { trans.RollBack();...

Help with a SQL Query

(newbie, help if you can please) hi, i could use some help writing a SQL query. i'm trying to display some data from one table but the data i need depends on a value from a different table. i'm pretty new to this so i will try to explain this the best i can: i have an 'Orders' table with a 'ShipCity' and 'OrderId' columns. i would like...

Between .. and clause in sql server?

hi, in my web application i am displaying videos of user, I want to display the videos which are between 30 days only. Videos that are uploaded last 30 days only. i write query like this but it is not working fine.. select * from videos where posteddate between getdate()-30 and getdate() order by posteddate desc can u he...

SQL Query Performance

I have a table with [1 million data ,11 columns]. My select query [select * from tbl] seems to be taking 2 minutes to complete. Server is SQL Server Express 2005. Table has a clustered index [primary key], no other indexes. If I create a copy of the table using select * into table1 from tbl, then the same select query on the new table ...

How to handel Select,Update query on foreach loop?

SERVER A: public string connStr = "Data Source=PH-09-5336;Initial Catalog=InventoryDB;Integrated Security=True"; SERVER B: public string connWIP = "Data Source=PWODU-COGNOSDB3;Initial Catalog=BI_SOURCE; I have this method of inserting records to InventoryDB.DBO.FG_FILLIN from excell file. Select records from BI_SOURCE.dbo.ODU_WIP_PI ...

How to sort string in sql server

How to sort this data in sql server as Pre-OP 1, Pre-Op 2 like wise Pre-OP 1 Pre-OP 10 Pre-OP 11 Pre-OP 12 Pre-OP 13 Pre-OP 14 Pre-OP 15 Pre-OP 16 Pre-OP 17 Pre-OP 18 Pre-OP 19 Pre-OP 2 Pre-OP 20 Pre-OP 21 Pre-OP 22 Pre-OP 23 Pre-OP 24 Pre-OP 25 Pre-OP 26 Pre-OP 27 Pre-OP 28 Pre-OP 29 Pre-OP 3 Pre-OP 30 Pre-OP 4 Pre-OP 5 Pre-OP 6 Pre-OP...

Avoid NULL columns using DEFAULT Empty String

Hi, how can I create a Column with the default value being an empty string? thanks guys! ...

Safest way to get last record ID from a table

In SQL Server 2008 and higher what is the best/safest/most correct way to retrieve the ID (based on autoincrementing primary key) out of the database table? to retrieve the value of the last row of some other column (like, SELECT TOP 1 FROM Table ORDER BY DESC)? ...

Database design to support multiple clients

If you were building a database with tables Documents, Clients, Users and Firms, where in Firms you would store the companies that use the software how would you design the first three tables to support multiple Firms to store in them? So, in Documents we want to store documents for all the firms, of course, we need to tell them appart s...

How to put column name in sqlsever CAST data type??

Hi, Today, I have started writing a query which is as given below: SELECT IP1.InstId,CAST(IP2.Quote AS DECIMAL(10,2)) AS 'CurrentPrice',IP1.Quote,(IP2.Quote-IP1.Quote) AS 'Change' FROM InstrumentPrices IP1 INNER JOIN InstrumentPrices IP2 ON IP1.InstId=IP2.InstId INNER JOIN Instruments I ON I.Id=IP2.InstId INNER JOIN Games G ON G.Id=I...

Best practice Date and Time registration

Hi, I am building a simple CMS to manage articles. My MS SQL Server 2008 is Hosted in USA, Author of Data Base are situated in USA and Germany. When a Author create an article in the DataBase I would like record the DATE of creation. I would like to show the date on the website as would all contents and articles are created from German...