sql-server

Convert string to DateTime in SSIS

The data from source has string data type and sometime has invalid dates, empty column ('') I want to check whether it is valid date and convert string to date time. How can i do this in SSIS? My string value is already formatted as mm/dd/yyyy. ...

How to send email from execute sql task?

Hi All, How can i send email if execute sql task get executed and loads a table. so, if table is loaded with any record send email, if not loaded no email. Appreciate any help. ...

CakePHP SQL Server Windows Authentication

I have CakePHP connecting to a SQL Server database using standard SQL Server authentication. If I want to connect via Windows Authentication instead has anyone tried this? Firstly I think it requires using the SQL Server drivers i.e. not the standard MSSQL PHP drivers so that PHP itself can use Windows Authentication. Then its the iss...

Need advice for my Server part

Hey, I'm stuck on my server part. I thing it would be fine if I make an REST architecture but I'm not sure. My application is that an identitied user edit his name, age, hobbies...and I want to stock all the informations of all the users on my data server. Then, I could send the information of a user to another in a ListView with an ad...

Why is my SqlDependency not firing.

I have a database running on MS SQL Server 2005 and an ASP.NET 3.5 web application. The database contains a product catalog which I'm using to feed "pages" into a CMS running in the web app. Once the pages have been created the application caches them so I need to notify the application of this change so it can recreate the page objects...

How do I force a refresh of a fulltext index within a transaction in mssql?

I am trying to figure out how to get the following code to return the row that it just inserted - a co-worker pointed out and suggested running ALTER FULLTEXT CATALOG uiris_production REBUILD but that cannot be run within a user transaction. The reason this has to be in a transaction is that this is coming from a test framework where th...

Add 'last' class to records from query

Hi there, I'm using a parametized query to get records that will display as a grid of products on a page. My design has 4 products listed in each row, but i'd like to apply a class to every 4th item, so that I can clear any margins/padding. Here is my current code; <% Set conn = Server.CreateObject("ADODB.connection") ...

select rows with a set of values (in multiple rows in Conjunction [And]) in sql Server

Hi All, Suppose I have a table like: id............value ``````````````````` A............1 A............2 A............3 B............1 and so on. so, If I want to select rows with Value either 1 OR 2 OR 3, I do this: select id From table where value in (1,2,3) But, what I want to do is, select id with AND instead of OR. I wan...

How can I get a list of tables in a SQL Server database along with the primary key using ONLY C#?

Given a database, how can I retrieve a list of Tables along with the primary key of each table? Thanks. Edit: This is for a code generation tool I'm making, I need to somehow run the SQL script using C# only. ...

Convert textbox text to integer

Hi, I need to convert the text in the textbox of my xaml code to an integer value in C#. I am using .NET 4.0 and Visual Studio 2010. Is there a way to do it in xaml tags itself or do i need to write a converter in C sharp. I tried the following but is not working: Convert.ToInt32(this.txtboxname.Text) Any help is much appreciated. Tha...

How do I count two entries in one SQL Query in C#?

I have two columns in my ForumPost Table: Id and ThreadId. I want to count all Entries in Id and ThreadId for a specific User: Code snippet cmd = new SqlCommand(); cmd.Connection = connection; cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = @"SELECT dbo.ForumPost.ThreadId, " + "Id, " ...

SQL Collalation issue

Hi there, I have noticed in my Local SQL Express 2008 the collation of my system databases are different then my customs tables I created our servers. Is there an options to set the Collalation when installing? I tried to change it in the database properties but get errors ...

How do I change the destination service name of a queue / service

I have a SQL Server 2005 Service Broker queue "ProductChangeMessages" and a Service Broker service "ProductChangeNotifications". The pair are the backing to an SqlDependency I'm trying to get working but the OnChanged of the dependency doesn't fire. When the table being watched changes the subscription (visible through the results of sel...

ampersand in password problem - php

Pretty much what it says on the title. I am trying to connect to a Microsoft SQL Server database with a password which contains an ampersand: <?php $mssqlHost = "Reports.autotask.net,1433"; $mssqlUser = 'NetworkROI'; $mssqlPass = 'Rosdcpe7&Essdcscpalda'; //has been changed $mssqlATDB = 'TF_3745000_WH'; $SQLConnect =...

Does the SQL Server JDBC driver support asynchronous operations?

From some googling, it appears that .NET supports asynchronous operations with SQL Server 2005+. Does the latest JDBC driver support this? I can't find a mention of it anywhere, so I'm thinking it probably doesn't. But I figured it couldn't hurt to ask. Thanks! Avi ...

solve numeric overflow problem when converting to float

I have a float value that i need to do some calculations on and insert into a numeric(9,2). However in rare (and likley erronous) cases there are some data anomolies and I end up with a value that will not fit into numeric(9,2). What is a good solution to this problem? Maybe just use 9999999.99 if the number is 9999999.99 or greater? A...

SQL Server - Give a Login Permission for Read Access to All Existing and Future Databases

I have a stored procedure that finds all the existing databases and reads from a table in each one. Is there a way I can give a login read access to all databases, and to all future databases i.e., I won't have to do anything when a new database is added? Is there a server role that would work? Is there a way to make a SQL agent job ...

What is the difference between Shrink Database and File?

DBCC ShrinkDatabase() DBCC ShrinkFile() Do I need to run both DBCC commands in order to shrink the database? What is the difference between these two above? ...

VS 2010 Database Project - Import Database Objects and Settings

Does anyone know if there is a way to ignore users and roles when performing an "Import Database Objects and Settings" on a new SQL Server 200X Database Project from within Visual Studio 2010? I have tried setting these object types to ignore within Tools/Options/Database Tools/Schema Compare/Object Types, but that didn't seem to work. ...

SQL Server database recovery

I simply copied my .mdf/.ldf files to another file and suddenly my Microsoft SQL 2008 database dies. I can't open these files on another system either. Can anyone explain what's happened? Any way to recover this application's database now? ...