sql-server

PHP + PDO: Bind null if param is empty

I'm trying this (and all PoST var are treated before user send it, no SQL Injection worries): $stmt = $con->prepare($sql); $stmt->bindParam(":1", $this->getPes_cdpessoa()); $stmt->bindParam(":2", $this->getPdf_nupessoa_def()); When any of those vars are NULL, PDO cries and don't let execute my statement, and on my Table, i DO allow th...

SQL Server: Determine the last time a row was added to a table

Possible Duplicate: SQL Server - what is the date/time of the last inserted row of a table ? Is there a way to determine the last time a row was added to a table? I don't need to know any specifics, just a date would be fine. ...

Exclude apostrophes from SQL Server Full Text Search

Hi, I would like to know how to exclude apostrophes from being indexed in full text search. For example, if someone enters a search term for "o'brien" or for "obrien" I would want it to match all cases where someone's name matches either "O'Brien" or "OBrien". However, if I search on: select * from MyTable where contains (fullName, '...

Anyone using Change Data Capture for Replication?

I'm soon going to be involved in a project to replace our current method of replication from transactional replication to some other method (for various reasons). I'm considering using CDC as an alternate method. I'm envisioning CDC capturing all the changes and then another process would read the changes and apply them to a target datab...

Check FK Constraints after BULK INSERT

I have a couple of big datasets ( ~O(1TB) ), which I want to to import into my database. I use BULK INSERT to import data into temporary tables, then use SELECT and INSERT INTO to fill my real tables with the data. This is because I want to change the order of some things, and split some data files into logical tables. And if this functi...

Good practice to modify MSDB stored procs?

At work, we've working on SQL Server 2008 now, and my boss seems a little bit paranoid about security, so instead of having people be sysadmin (or whatever they need to be to own/modify jobs) he's been editing stored procs in MSDB (such as sp_update_job) and adding a role to the TSQL that checks for required permissions (such as adding S...

How can I convert a varchar with hexadecimal value to int?

I need to convert a VARCHAR with a hex number to INT, I tried: DECLARE @H VARCHAR(2); SELECT @H = '9a' SELECT CONVERT(INT, 0x + @H) But it says @H has to be a VARBINARY, and if I cast I get a completely different number. From '9a' I want to get 154, how can I achieve it? ...

How do I stop varbinary data from being truncated to 256kb when reading from an SQL Server database using adodb for php

I am writing code for a client of ours which is designed to read an image from a SQL Server database into a file in a caching directory. The binary data is being truncated at 262144 bytes (256kb). The column is of type varbinary(max), and we are using the ADOdb for Php to access the database. What is the cause of the truncation, and h...

CHAR function on SQL Server is returning different values on different servers

When I do SELECT CHAR(193) On my local database it returns Á, but when I do the same on a database running on another server it returns ┴. I expect Á as the correct value, how can I fix the function? The databases were created individually, they aren't exactly the same. ...

Can this be done with Entity Framework 4 ? If not, what can do this?

Hi folks, I'm making a simplistic trivial pursuit game. I'm not sure if (and then how) I can do the following with EF4 :- I have a table structure as follows. Table: TrivialPursuitQuestion => ID => Unique Question => AnswerId => AnswerType (ie. Geography, Entertainment, etc). Table: GeographyAnswer => ID => Place Name => LatLong ...

Renaming table column and having it propagate to dependent views

If we want to change the name of MyColumnName to MyAlteredColumnName... ...and we have a SQL Server 2008 table that looks like: MyTable MyColumnName and a view that references the underlying column: CREATE VIEW MyDependentView WITH SCHEMABINDING AS SELECT ..., MyTable.MyColumnName We end up following this procedure: Dropping t...

Bing.com and SQL Server FTS?

Does bing.com use SQL Server Full Text Search feature? If yes, is there some details about how it uses it? Thanks. ...

Error while creating view in SQL Server 2000

Hello All, I am trying to create a view as following in SQL Server 2000 CREATE VIEW [dbo].[AC_VW0901] AS SELECT CASE T2.ItmsGrpCod WHEN 102 THEN T2.ItmsGrpCod WHEN 103 THEN T2.ItmsGrpCod WHEN 107 THEN T2.ItmsGrpCod WHEN 108 THEN T2.ItmsGrpCod ELSE 100 END AS ItmsGrpCod, CASE WHEN Month(T0.TaxDate) >=4 A...

DMF and DMV in SQL Server 2008

What are Dynamic Management Functions (DMF) and Views (DMV) in SQL Server 2005/2008 ? ...

Restart SQL Server instance using SMO

My C# application uses SMO to do various things with SQL Server instance chosen by a user. Particularly, it changes authentication mode: ServerConnection conn = new ServerConnection(connection); Server server = new Server(conn); server.Settings.LoginMode = ServerLoginMode.Mixed; After changing login more instance should be restarted....

At a Cross-Roads: Choice Between MySQL vs MSSQL -> Importance: Reporting

I am currently working on an application for the health care industry for my firm. This application is geared towards the smaller end of the spectrum (as in 50 or less users). The application will offer both a windows forms (wpf) app and a Silver Light app. This application will be used in the insurance side of the health care equation (...

Why would I want to pay my webhost for a MS SQL database over a MySQL database?

I'm in the market for an ASP.NET host to start learning on and to host personal projects. I've noticed most of them provided both MySQL and MS SQL databases. However, usually they will only provided a couple MS SQL databases, but a large number (like 10) MySQL Databases. Can I use a MySQL database as a back end to a ASP.NET website? If ...

How do I obtain a list of Collections which contain Objects which Implement an Interface in C# or VB.net

I am new to .Net Programming and would like to know if Reflection is suitable for traversing an Object to discover Collections within an instance of a class. I am working with the Microsoft.SqlServer.Management.Smo Namespace. The plan is to connect to a database, determine what collections exists, then for each of those collections, if...

Smo does not show 2008 SQL Server instances when 2005 instances exist

I am trying to enumerate all SQL Server instances installed on a local machine. I am using SmoApplication.EnumAvailableSqlServers(true). However, only SQL Server Express 2005 instances are shown. Default 2008 instance is not shown at all! I tried 2 other solutions with SqlServerRegistrations.EnumRegisteredServers() and SqlDataSourceEnum...

SQL Profiler - What could be improved?

I don't know much about SQL Profiler and just purchased Brad McGehee's book, Master SQL Server Profiler to learn more. In the book, he says, a couple times, how bad the user experience is, and that it could be more feature rich. For those of you with Profiler experience, what would you like to see changed or improved? Thanks very muc...