sql-server-2005

What allows a Windows authentication username to work (flow) between 2 servers?

Typical ISP setup. One server is the web server, another is the DB SQL server. There is a local administrator account, let's say XYZ, created on both machines. So when I log in remotely, I am either WebServer\XYZ or DBServer\XYZ, depending where I log in. Now, when I login to SQL Server SSMS on DBServer using Windows Authentication, ...

Can you have cascading report parameters from a dropdown to a textbox?

I have a SQL Server 2005 Reporting Services report with three parameters I'd like to implement some kind of dependency relationship between. The first parameter is DateRange which is a drop down with various numbers of days back to make a date range from the present day. It will have a "Custom" value which will be used to flag when th...

Copy SQL Server data from one server to another on a schedule

I have a pair of SQL Servers at different webhosts, and I'm looking for a way to periodically update the one server using the other. Here's what I'm looking for: As automated as possible - ideally, without any involvement on my part once it's set up. Pushes a number of databases, in their entirely (including any schema changes) from on...

Dynamically Filter data in a DataGrid

I have a ComboBox with the values "open", "closed". According to values changed in the ComboBox, I want to change the DataGrid to display either "open " or "closed" values. How can I do this? ...

how save SQL stored prodecures to .sql files via batch

Hello! I woud like to save my MS SQL Server 2005 stored procedures to .sql files automatically (would prefer a tool which I can call via .bat) so I dont have to click each single sproc manually and save it. I have already found SMOscript from devio IT, but it gathers all tables and sproc which takes some time. Is there any similar tool ...

How to detect a string of data from xml in Xquery

I have an untyped XML column in Sql Server Database which holds values such as 1 <root><a>123</a></root> <root>23d</root> 23 I was trying with the following query declare @x xml set @x='1' select @x.exist('xs:int(.)') But here the problem is exist function will return 1 even if @x='<root><a>12</a></root>' I would like the ou...

Japanese/Chinese language data in SQL Server table

So I've got an interesting problem that I need help with faster than I can get my skills with SQL Server up to par. We have a table that contains a bunch of text, all of it in different languages. Most of this data appears correctly in the browser, however, anything in Chinese or Japanese gets completely mangled by the browser. This i...

What is the best way to assign the returned value of a stored proc to a variable in SQL?

I have a stored procedure that returns a valueI call it from other stored procedures that need to retrieve this value. The calling stored procedure is inside a transaction, the stored procedure that returns the value (and actually creates the value and stores it in a table that no other proc touches) is not inside its own transaction, bu...

Q: generic SQL to get max value

it is very easy to use the following SQL to get value for a specific primary key: ID from a specific table: myTale: DECLARE @v_maxID bigint; SELECT @v_maxID = MAX(ID) FROM myTable; What I need is a generic SQL codes to get the max value for a key from a table, where both key and table are specified as varchar(max) types as parameters:...

Make SQL Server faster at manipulating data - turn off transaction logging?

I use SQL Server 2005 as a data store for a lot of data I do analytic work on. This is not a transactional database as I am not hitting it with updates or capturing real time data. I get a few gigs of data from my clients, load them into SQL Server and do a series of manipulations. I then grab bits of this data and pull them into R where...

Reset primary key (int as identity)

I have a table with a primary key as bigint (identity property is Yes and staring from 1 by 1). This table is in production and has been updated on daily bases: lots of deleting and inserting. The problem is that this key is growing too big right now with 8 digits. I worry about overflow one day eventually. Fortunately, this key is not...

Data Migration in sql 2005

In my Live sql database ,I have to change the date value from (date, month ,year) to date. Now there is 100 records with the date as date,month ,year(3 Fields).iF I change directly to date Field all the datas in the 3 field of those 100 records will automaticly change to a default date and original dates will disappear.What should i do ...

How can I export my ASP.NET page to Excel?

How can I export the data in my webapp to an Excel sheet from ASP.NET (VB.NET,SQL 2005)? ...

What's the best way to diff two database backup files with MS Sql Server 2005?

I have two database backup files. I would like to know if there is any difference between the two. I could go row by row, field by field and do a diff (I'm not looking for differences in schema but rather data, although I expect the schema to remain the same). Can I run some sort of checksum on the files, or do I have to go through the ...

Insert all values of a table into another table in SQL

I am trying to insert all values of one table into another. But the insert statement accepts values, but i would like it to accept a select * from the initial_Table. Is this possible? ...

Why is query slow but procedure fast on SQL Server?

Why is it that if I run my query as a parameterized procedure it runs 10 times faster then if I run it directly as a parameterized query? I'm using the exact same query in both cases, and it doesn't matter if I'm calling from Management Studio or an SqlCommand from code. EDIT: The execution plan looks different. So, why? I'm calling ...

Select records from XML column (SQL Server 2005) based on node order

I have a column in a SQL Server 2005 table defined as an XML column. Is there a way to select records from this table based on the order of two nodes in that column? For example, we have the following structure in our XML: <item> <latitude/> <longitude/> </item> I want to see if there are any records that have latitude/longitu...

Useful system stored procedures in SQL Server

I recently discovered that I could use the sp_help to get a table definition and have been hooked onto it since then. Before my discovery, I had to open up the Object explorer in SQL Management studio, manually search for the table name, right click on the table and select Design. That was a lot of effort! What other system stored proce...

Is there any performance advantage to storing dates as ints in MS SQL Server

Either in terms of space or speed of queries and comparisons of fields? ...

SQL Server Trigger - Send Message to Queue

Is it possible on a CLR trigger in SQL Server 2005 to send a message to a queue via MSMQ? I am using the SQL Server Project type, but System.Messaging does not appear as a reference I can add. Basically I need some type of action to take place (printing) when a row is written to the table. The device generating the row is a hand hel...