sql-server

VARBINARY output in MS MGMT Studio different than Powershell/.NET

I'm in a bit of a situation with outputting data from a table where the only column I'm selecting is a VARBINARY(MAX) type. In management studio, when I execute the query, I get back what I expect in the format: 0x1FABCDEFG......etc Now, when the same query is executed in powershell, via a simple setup of a SqlCommand, SqlDataAdapter...

How do I access a SQL Server database from a Perl script in Linux?

I have a Perl script on a Linux (Ubuntu 8.10) machine and I need to write data to a SQL Server Database. I've been trying to use the DBD::ODBC module but I can't get it to connect. Where can I get a free/open source driver to use to use for the ODBC connection or is there another way to do this from Perl on Linux? ...

SQL Server 2005->2008 upgrade: detach/attach vs. backup/restore?

There was a similar thread on this earlier, but my question is specific to upgrading from SQL2005 to 2008: when upgrading in-place is not possible because the machine has to be re-imaged, which method is preferrable - detaching and re-attaching the db files, or backup/restore? Detach/attach is obviously faster and accoding to msdn possi...

SQLCMD running as builtin Admin Group

How to run SQLCMD with builtin Administrator Group. ...

How can I best avoid using reserved or key words in my language or framework?

Naming things is hard. When naming my classes, variables, and methods I strive to avoid collisions with reserved words or keywords in my languages (MSSQL, VB.NET or C#, HTML, CSS, jQuery) and framework (.NET). Too often I make mistakes and don't realize it until it's too late to easily go back and rename. A scenario: (1) first create ...

Query Actual Execution Plan VERY different from Trace results

I have rebuilt indexes and updated statistics. The query is straightforward, with a subquery in the WHERE clause. SELECT TOP 1 * from MeetingPost_reg WHERE userid = 1234 AND meetingpost_regid <> 9999 AND DateStart < (SELECT DateStart FROM MeetingPost_reg WHERE meetingpost_regid = 9999) ORDER BY DateStart desc There is an index on da...

sql server field naming conventions

i have a database that has 50 tables and all the tables have primary key on a field named ID. so example, Employee.ID, Customer.ID, order.ID, every single table has ID as its primary key. should it not be Employee.Employee_ID, Customer.Customer_ID and so on? is there any drawback of using ID as name of every ID field in each table? if so...

How to tell Linq which Database Version to use

i am using sql server 2005 and I think Linq generating queries for a different database version. I got the query string that linq was producing and pasted the linq directly in SQL Server Management studio and it failed with many errors. But the query works well if Linq is used. Any ideas what could be going on. If linq needs to know what...

SQL Management Studio: Can i change the tray icon?

Hi there, I always have loads on windows open and i can very see the SQL Management Studio when it is minimised, the icon is too light a color Is there a way of changing the icon? ...

Can I have index created on temp tables (#temp) which are created dynamically in a stored procedure?

I am creating temp tables (#temp_table) in my stored procedure. It is a huge table with large data. Then I am creating a index in the storeed procedure as it is required for faster query to the temp table. But when I execute the stored procedure, the index is not used. The index is not being created when the stored procedure is executed....

LINQ puts unwanted trailing spaces on strings

Hi I have a very annoying problem with LINQ and MS SQL Server. Im currently making some software in WPF C# and use LINQ to generate classes from the data in the database. However, when i update a nvarchar or varchar field in the DB from my program, LINQ adds trailing spaces to the string! I have a field in a table defined like this: ...

Moodle with SQL Server

Hello everyone, I'm having a tough time integrating moodle with sqlserver through FREEDTS even after reading the documentation in the moodle site. I've setup the settings in freedts.conf,php.ini and Config.php. But, inspite of all this it does not connect to my database. I'm using SQL Server 2008. What could I possibly be missing? T...

SQL Full Text search on HTML/XML data

I have a sql full text catalog on a cms database (SQL 2005). The database holds the CMS page content within a ntext column which is part of the full text catalog. As expected the searching takes into account the xml tags within the page content so searching for "H1" returns all the pages with H1 tags. Is it possible to apply filters wi...

BizTalk server problem

Hi, we have a biztalk server (a virtual one (1!)...) at our company, and an sql server where the data is being kept. Now we have a lot of data traffic. I'm talking about hundred of thousands. So I'm actually not even sure if one server is pretty safe, but our company is not that easy to convince. Now recently we have a lot of problems. ...

Monitoring SQL Server Bandwidth

I think I can use NetMon to monitor traffic (b,kb,mb, gb) of my db (to/from) , however I dont know how to get a summary and breakdown of the traffic size. Has anyone used Netmon for this and can either explain how or point me in the right direction. Everything is local in my scenario , I just want to know the bandwidth usage of the db...

One T-SQL query output to multiple record sets

Don't ask for what, but i need two tables from one SQL query. Like this... Select Abc, Dgf from A and result are two tables abc 1 1 1 dgf 2 2 2 More details? Ok lets try. Now i have sp like this: SELECT a.* from ActivityView as a with (nolock) where a.WorkplaceGuid = @WorkplaceGuid SELECT b.* from ActivityView as a wi...

java:getting sqlexception message "incorrrect syntax near '{' ".

platform :sql server 2000 java 1.4 String queryStringForCustomer = "{call MIGRATE_CUSTOMERS_FILE(?,?)}"; String queryStringForCard = "{call MIGRATE_CARDS_FILE(?,?)}"; for(int i=0;i<recordIds.size();i++) { if(FileType.equals("1")){ callableStatement = connection.prepareCall(queryStringForCustomer); callableStatement.setString(1,(Str...

Import SQL Server database from large script

Opening large sql script generated by SQL Server publisher cant be open in management studio, returning error about not enough available storage to open it. Is there some other way to import db from large script ? (command line maybe) ...

Problem with if-statement used at Table-returned-function in SQL

I have simplified my function to the following: create function [dbo].[UserSuperTeams](@ProjectId int) returns table as return if @ProjectId=0 begin select TeamId from TblTeam t union select 0 as TeamId end else begin select t.TeamId from TblTeam t union select 1 as TeamId ...

SQL Server 2000 command line utility

Is there anything like the SQL 2005 SQLCMD for SQL 2000? I need to run updates/deletes in an unattended mode. ...