I need to do the following query (for example):
SELECT c1.CustomerName FROM Customer as c1
INNER JOIN [ExternalServer].[Database].[dbo].[Customer] as c2
ON c2.RefId = c1.RefId
For some security reason my client doesn't allow me to create a linked server. The user under whom I execute this query has access to both tables. Is it possibl...
Sorry if already asked, but I can't find anything on this.
I am moving something over from MySQL to SQL Server I want to have a .sql file create a database and tables within the database. After working out syntax kinks I have gotten the files to work (almost).
If I run
IF db_id('dbname') IS NULL
CREATE DATABASE dbname
it works ...
I'm very new to SQL so forgive my ineptitude.
I'm trying to write a trigger that, on insert to table 1, inserts that record into table 2.
table 1 is [rps_lab_dev].[dbo].[Lab_Employee_Time_Off]
table 2 is [dbo].[Lab_Employee_Time_Off_Detail]
CREATE TRIGGER updatetrig
ON [rps_lab_dev].[dbo].[Lab_Employee_Time_Off]
FOR INSERT
AS
...
...
Is there a way to call a HTTP web service from T-SQL (no SQLCLR) in Sql Server 2008? I just need to send information out, I do not need to receive anything into T-SQL.
Thanks.
...
Hello, I am designing a User table in my database. I have about 30 or so options for each user that can be either "allow" or "disallow".
My question is should I store these as 30 bit columns or should I use a single int column to store them and parse out each bit in my application?
Also, our database is SQL Server 2008 and 2005 (depen...
So I've got a query that keeps deadlocking on me. People who know the system well can't figure out why the sproc is deadlocking, but they tell me that I should just add this to it:
SET NOCOUNT ON
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
Is this really a valid solution? What does that do?
...
Hi
I have a script which creates a database, stored procs, views, tables, udf. I want to include a script to create a user 'user_1' and give execute permission on the database.
update
I tried following to create grant exec command for all stored procs
use DB;
go
declare @permission varchar(max)
select @permission = COALESCE(@permi...
Below is my query which is updating a record in the User table , I want the query to return the UserId which was updated, How can I do this?
UPDATE USER
SET GroupID = @New_GroupID
FROM USER
LEFT OUTER JOIN DOCUMENTS ON User.UserID = Documents.UserID
WHERE (Documents.UNC = @UNC)
AND...
What is the equivalent of RESTRICTED_USER database state in Analysis services?
When we try to process OLAP cubes, it fails because of active user connections to teh cubes. Is there a way to restrict the user access to analysis services only to database administrators like we do in SQL server.
...
I have column of strings with a ctiy state and number in each.
SPOKANE, WA 232/107
LAS VEGAS, NV 232/117
PORTLAND, OR 232/128
Theres many more than just that but I am wondering how either I could cut off the numbers in this column and jsut show the city and state or even better cut off the numbers and make c...
I have data I cleaning up in an old data table prior to moving it to a new one. One of the fields has spaces in the column, right & left. I wrote the following code to address this and still have leading spaces?? The bulk of the data is clean when using this code but for some reason there are spaces prior to RT addresses... Has anyone ...
whos could be much efficient if I use nestted subquery, JOINs Or maybe temp tables ..
another question : in subqueries if i use IN Clause twice with the same query it should be execute a twice too !? like this :
Select ...
From X
Where Exists( Select 1 From Y Where Idx = Y.SomeColumn )
Or Exists( Select 1 From Y Idy = Y.SomeColumn ...
Hello everyone.
I have a table containing user-account permissions and I'm trying to write a query to return one row for each user-account combination.
Here is what I have.
CltKey AcctKey TranTypeID Access
10 2499 10 0
10 2499 11 1
10 2499 12 1
10 2764 10 1
10 ...
Hello, I have a bit of SQL that is almost doing what I want it to do. I'm working with three tables, a Users, UserPhoneNumbers and UserPhoneNumberTypes. I'm trying to get a list of users with their phone numbers for an export.
The database itself is old and has some integrity issues. My issue is that there should only ever be 1 type of...
DBMS: MS Sql Server 2005, Standard
I'd like to make a table constraint to have only one record have a particular value within a subset of the table (where the rows share a value in a particular column). Is this possible?
Example:
I have records in myTable which have a non-unique foreign key (fk1), and a bit column called isPrimary to ...
Possible Duplicate:
Instead of trigger in SQL Server - looses SCOPE_IDENTITY?
On SQL Server 2008, I have an INSTEAD OF trigger on a view. The SCOPE_IDENTITY() after the trigger is results in null. This causes problems with the libraries we're using. How can I control SCOPE_IDENTITY from within my trigger?
This is absolutely n...
We are using SQL Server 2008. We have a table called response which has a primary key called response_id. It also has a column called bid_id. When we execute the query
‘select * from response where bid_id = x’
without an ‘order by’ we are getting results in mostly ascending order (default), but once in a while in descending order (ve...
Hi
I have a situation where given a Column "TotalDue" and a Percentage(17,5%)Could be anything.I need to deduct the percentage and put results in a table
CREATE TABLE #ResultTable (NettAmount money, GrossAmount money)
For example sake lets take AdventureWorks database they have a totalDue Column on
SELECT TotalDue from Sales.SalesOrd...
Hi everyone. Does anyone know if it's good solution to use SQLite in multi-thread environment.
I want to replace SQL Server with more simple and built-in database as there is no need to feed such big server DB. The supposed max size of DB would be 4 gigabyte after 4-5 years of usage. Is it normal for built-in DB? Could it affect performa...
Hi,
as mentioned in title. Another details:
file is in on my hard drive in App_Data directory
I have Microsoft SQL Server 2005 on my localhost installed (full, not Express edition)
When I try to connect to file using Server explorer Microsoft SQL Server Database File I get an error:
network-related or instance-specific error occ...