sql-server

Trigger to update data in another DB

I have the following schema: Database: test. Table: per_login_user, Field: username (PK), password Database: wavinet. Table: login_user, Field: username (PK), password What I want to do is to create a trigger. Whenever a password field on table per_login_user in database test get updated, the same value will be copied to field...

Do Instances Share Same Services? - SQL Server

Lets say i installed two named SQL Server 2008 instances e.g. A and B, will i have two services of each type e.g. two analysis service, two reporting service and so on, one service for A and the other for B? If yes, then it is known a service listens on a port number, how two same services going to listen on the port? I hope this is cle...

How many Stored Procedures created everyday ( problem in converting Datetime )?

I make a query that return to me the count of Stored Procedure that created everyday as follow SELECT convert(varchar, crdate, 103) as Date,Count(*) as Counter FROM sysobjects WHERE (xtype = 'p') AND (name NOT LIKE 'dt%') Group by convert(varchar, crdate, 103) and its already work but dates appear in string format that i can't...

Why was this T-SQL Syntax never implemented?

Why did they never let us do this sort of thing: Create Proc RunParameterisedSelect @tableName varchar(100), @columnName varchar(100), @value varchar(100) as select * from @tableName where @columnName = @value You can use @value as a parameter, obviously, and you can achieve the whole thing with dynamic SQL, but creating i...

Any succesful document management sytem (application using documents intensively) using sql server filestream?

Did anyone create a Document Management System using SQL SERVER's Filestream? By this I mean: if an application makes intensive use of documents is filestream a good option, or in those cases it would be better to go for another solution? I understand this depends on many factors, but in general my guess is that if "<5%" than server lo...

How to insert exisitng documents stored on NFTS in sql server filestream's storage

I am doing investigation on filestream (asking on stackoverflow while reading whitepapers and google searching), in my current screnario documents are managed in this way: 1) I have a DB table where I keep the document id and the doc path (like \fileserver\DocumentRepository\file000000001.pdf) 2) I have a document folder (\fileserver\D...

free, recommendable Tools for data modeling?

Hello, are there free, recommendable Tools for data modeling? ERM/ORM Diagrams Creating database models (SQL SERVER 2005) As Simple to use as Visio(no license here) Code generation is only a nice to have (VB.Net) ...

execute procedure for a sequence of elements (execute theProc (select id from table))

I need to execute the procedure deleteQuestion for each element that was returned by this select query: select id from questions where Stuff = @Stuff execute deleteQuestion id something like: execute deleteQuestion each(select id fom questions where Stuff = @Stuff) anybody knows how ? ...

circular foreign key. How do i handle them?

Much of my sql code is generated (from POD). Now i have issue where table user_data has a FK to ref_status which points back to two different user_data. My code does the following begins a transaction looks at user_data (and adds it to a list) sees ref_status then repeats #2 with it executes the create table ref_status code Then i g...

Contents of SQL profiler logs

What does the SQL Profiler logs contain? Suppose that I am using SQL Server 2000 and do some transaction using VC++/ODBC connection. If a CDBException is thrown, will the profiler log contain information about why it is thrown? Thanks. ...

SQl Server error handling pattern

Hi all. I am not an expert on SQl Server. Is this a valid pattern for handling errors in a batch of SELECT, INSERT...in SQl SERVER ? (I use v.2008) BEGIN TRANSACTION BEGIN TRY -- statement 1 -- statement 2 -- statement 3 COMMIT TRANSACTION END TRY BEGIN CATCH ROLLBACK TRANSACTION END ...

SQL Server Login - failed login attempts

Hello All - Is there a way to set consecutive failed login attempts to a specific number like 3 or 4 times (for SQL Server Logins)? If this count is crossed the expectation is to lock the account... Apprecaite your help. Thanks ...

How can I set my deployment options to script the incremental release of a Visual Studio 2010 database project?

I've just started using a VS2010 database project to manage the release of an update to an existing database. I want the deployment option to generate a script that will contain the commands to change my existing database rather than create an entirely new one. E.g I have 10 existing tables - one of which I drop in the new version and ...

Table fragmentation in SQL server

Hi Anybody have an idea about Table fragmentation in SQL Server(not Index fragmentation).We have a table ,this is the main table and its not storing any data permently,dat come here and goes out continusly. there is no index on this because only insert and delete staements are running frequently. recently We face a huge delay for the res...

What is the best way to implement multilingual domain objects using NHibernate?

What is the best way to design the Domain objects which can have multi-lingual fields. An example can be a Product class with Description being multi-lingual. I have found few links but could not decide which one is the best way. http://fabiomaulo.blogspot.com/2009/06/localized-property-with-nhibernate.html (This stores all localised ...

Visual Studio build and deploy ordering

We have a VS 2010 solution that includes a few class library projects, a SQL Server 2008 database project and a Wix setup project. We are trying to get to a point where the following happens in the order specified: Build the class library projects and the database project Deploy the database project to generate the deploy .sql script B...

Connecting to an MS SQL Server from Silverlight?

Normally, I would use a PHP webservice to do this, but since the front-end is hosted on a linux box, I need another way to do this (so I don't have to go through the trouble of installing FreeTDS, etc. I will if I have to). Is there a better way to do this? I'm not a web guy, but I'm trying my best. ...

Dynamic ORDER BY in SQL Server

I saw some topics about this, but the problem is that the solutions required a "switch case"... Like this I have a table with a lot of columns, is there a way to do a dynamic sort without the switch? ...

SQL Alter: add multiple FKs?

From here ALTER TABLE ORDERS ADD FOREIGN KEY (customer_sid) REFERENCES CUSTOMER(SID); How do i add several keys with SQL Server? is it something like the below? (I cant test ATM and unfortunately i have no way to test queries unless i run it through code) ALTER TABLE ORDERS ADD FOREIGN KEY (customer_sid) REFERENCES CUSTOMER(SID), A...

Update Multiple records in SQL Server

Hi all Here is my situation: I use the SqlCommond to update some records in the SQL Server in a ASP.NET web site. Users can choose which records they want to update. Sometimes they may choose 40 or 60 records to update at a time.Is there any good way to do it? I do not want to do like it foreach(string ID in List) { Update here } ...