sql-server

DBCC CHECKIDENT -- Schema aware???

I've got a different schema (besides dbo) that I've created a table in, schema "Chemical". I've tried 4 different variations of this DBCC CHECKIDENT, and they all bring back the same error: "Incorrect syntax near '.'" I've tried: DBCC CHECKIDENT (Chemical.[Products], RESEED, 0) DBCC CHECKIDENT (Chemical.Products) DBCC CHECKIDENT ([...

Website Forms Authentication -> Sql Server Windows Authentication

To cut a long story short: As part of an online database access system I'm writing I want to use the new BLOB access features in SQL 2008 - this means I have to use Windows Authentication when logging into the SQL Server; however due to it's very nature the website front end to all this uses Forms authentication with the membership data ...

SQL Server Bulk insert of CSV file with inconsistent quotes

Is it possible to BULK INSERT (SQL Server) a CSV file in which the fields are only OCCASSIONALLY surrounded by quotes? Specifically, quotes only surround those fields that contain a ",". In other words, I have data that looks like this (the first row contain headers): id, company, rep, employees 729216,INGRAM MICRO INC.,"Stuart, Becky"...

sqldatasource.select not taking account of FilterExpression on explicit select call?

Meh! Can't understand what happens here. The filter is correctly applied when used on SqlDataSource1, to correctly populate the corresponding gridview. That being said, the filtering isn't applied on the manual select that I use to get a DataView, for the database insertion part. What am I doing wrong? Is there something going on that...

Why is a space a valid column name in SqlServer?

See for yourself: create table #temp ([ ] varchar(1))<br /> insert into #temp values ('1')<br /> select [ ] from #temp<br /> What in the world is the rationale for allowing this? ...

Large sets of sql parameters in query

I have two disconnected sql servers that have to have correlated queries run between them. What is the best way to run a query such as: select * from table where id in (1..100000) Where the 1..100000 are ids I'm getting from the other database and are not contiguous. The in clause doesn't support that many parameters, and creating a ...

Is it possible to connect to SQL server asynchronously?

I know how to execute commands on SQL server asynchronously using Begin/EndExecuteNonQuery, but is there a Begin/EndOpen method on the SqlConnection class? I would like this to be asynchronous because sometimes it is slow and I don't want to block a thread the whole time. Does this make sense? ...

ASP.NET MVC Tutorials using SQLServer?

How can I use SQLServer (instead of SQL Express) as my database? I'm trying to go thru the ContactManager tutorial, but I can't seem to get it to use SQLServer - when I pick SQLServer from the "Add New Item" dialog, I get an error telling me that SQL Express isn't installed. I know I must be missing something basic... ...

Calculating the difference between two dates

I have a report that calculates multiple date differences (in business days, not DATEDIFF) for a variety of business reasons that are far too dull to get into. Basically the query (right now) looks something like SELECT -- some kind of information DATEDIFF(dd, DateOne, DateTwo) AS d1_d2_diff, DATEDIFF(dd, DateOne, DateThr...

Is there a way to do parameterized queries in PHP 4 when using a MSSQL database?

I am doing some maintenance work on an older system that is running PHP 4 and talks to a MS SQL2000 database via FreeTDS. I know, it already sounds somewhat scary! A lot of the code used unsafe string-concatenation for generating SQL queries. I have done some work to try and filter the input to make things safer but it is giving me a ...

How do I delete from multiple tables using INNER JOIN in SQL server

In MySQL you can use the syntax DELETE t1,t2 FROM table1 AS t1 INNER JOIN table2 t2 ... INNER JOIN table3 t3 ... How do I do the same thing in SQL Server? ...

Reporting services 2005: Is there a way to dymanically change a report header?

I have a report that needs different header text on pages depending on the content of the page. Is there a way change the text in the header based on a piece of information on a page? Page 1 header: ITINERARY Page 2 header: ITINERARY Page 3 header: FARE RULES Page 4 header: RECEIPT The other issue is that eac...

Connecting to SQL server from Virtual PC

I have VS 2008 and SQL Server 2005 Developer edition installed on my desktop. I have a instance of XP running in Virtual PC and want to connect to the dev instance. I am logged on as a domain user on both the desktop and the Virtual instance of XP. When I try to connect I get a message saying "Server does not exist or access denied". ...

NHibernate mapping a reference table

I have a rather convoluted scenario/design to sort out and would much appreciate some advice or insight. I am trying to map the following with not much success. <class name="CalEvent" table="tb_calEvents" lazy="false" > <id name="id" column="id"> <generator class="hilo"/> </id> <property name="summary"/> ---snip---- <bag name="cat...

Using table just after creating it: object does not exist

I have a script in T-SQL that goes like this: create table TableName (...) SET IDENTITY INSERT TableName ON And on second line I get error: Cannot find the object "TableName" because it does not exist or you do not have permissions. I execute it from Management Studio 2005. When I put "GO" between these two lines, it's working. But ...

how to search data from a table in sql server

Dear All, can any one post any link/tutorial which will explain how to search data from a table in sql server ,like using some stored procedure...any example? In details: Lets say I have a table havinh columns ID,title,username description etc, so now first it will search for username and then title and so on. ...

Keep timestamp when copying my SQL Server database

I'm copying an SQL Server 2005 database from one server to another, with the Database>Tasks>Copy Database wizard, and it works great, except for the timestamp column whose values are not copied. Is there a way to have the timestamp values be preserved on database copy? ...

SQL Server 2005 support for Oracle-style autonmous transaction

Within a transaction is there a way to have data committed within it even though the transaction is rolled back? We're writing audit/logging information inside a transaction but we want to keep that information even though the transaction has to roll back. We've see an article that tries to copy the Oracle way but what we're really look...

Does the order of tables referenced in the ON clause of the JOIN matter?

Does it matter which way I order the criteria in the ON clause for a JOIN? select a.Name, b.Status from a inner join b on a.StatusID = b.ID versus select a.Name, b.Status from a inner join b on b.ID = a.StatusID Is there any impact on performance? What if I had multiple criteria? Is one order more maintainable than another? ...

How do you stop SSMS from inserting the date when scripting the DB?

When scripting a DB using SQL Server Management Studio (SSMS) it generates line like: /****** Object: ForeignKey [FK_NoteLinkAssociation_Link] Script Date: 04/24/2009 10:04:46 ******/ Is there a way to stop it from generating that line or the date part of that line? Reason: The DB is being scripted and stored in source control an...