I have two queries that retrieve all groups and all users in a domain, Mydomain
--; Get all groups in domain MyDomain
select *
from OpenQuery(ADSI, '
SELECT samaccountname,mail,sn,name, cn, objectCategory
FROM ''LDAP://Mydomain/CN=users,DC=Mydomain,DC=com''
WHERE objectCategory=''group''
ORDER BY cn
')
--; Get all users in dom...
Hi There,
I have a T-SQL statement that basically does an insert and OUTPUTs some of the inserted values to a table variable for later processing.
Is there a way for me to store the old Identity ID of the selected records into my table variable. If I use the code below, I get "The multi-part identifier "a.ID" could not be bound." error...
Can anyone come up with a SQL routine or ideas to systematically append an area code to the beginning of every field in our SQL Server 2005 database that does not have an area code in it?
Perhaps someone could tell us how to return only rows that are less than 10 characters long and how to append the 3 digit area code to the beginning ...
I have two tables:
EmployeeTypeA table
Name varchar(2000) field contains - 'john,sam,doug'
EmployeeTypeB table
Name varchar(2000) field contains - 'eric,sam,allen,stephanie'
What is the most efficient way to return a true or false when a name is found in both lists using MS SQL? This needs to be done within a stored procedure so I ca...
I have a table in my warehouse that has columns in all uppercase. It scripts out like this:
CREATE TABLE [dbo].[Outlet](
[OUTLET_KEY] [varchar](10) NOT NULL,
[OUTLET] [varchar](8) NULL,
[CITY_CODE] [varchar](4) NULL,
[OUTLET_NAME] [varchar](25) NULL,
[COUNTRY_CODE] [varchar](3) NULL,
[EXTENDED_CATEGORY_CODE] [var...
I'm trying to do quite a lot of querying against a Microsoft SQL Server that I only have read only access to. My queries are needing to work with the data in very different structure from how the DB architecture is. Since I only have read access, I can't create views, so I'm looking for a solution.
What I'm currently doing is using com...
I need to split a report by work week, and our work week is Saturday through Friday. How would I convert an ISO week from DATEPART(WW, ) into a work week?
...
I found this snippet of SQL in a view and I am rather puzzled by it's purpose (actual SQL shortened for brevity):
SELECT
COALESCE(b.Foo, NULL) AS Foo
FROM a
LEFT JOIN b ON b.aId=a.Id
I cannot think of a single reason of the purpose of coalescing with null instead of just doing this:
SELECT
b.Foo AS Foo
FROM a
LEFT JOIN b ON...
I have a delete trigger on a table which is used to delete entries from a table in an another database.
CREATE TRIGGER [dbo].[Trigger_Contracts_Delete] ON [dbo].[Contracts]
AFTER DELETE NOT FOR REPLICATION
AS
IF @@ROWCOUNT = 0 RETURN
DELETE seconddb.dbo.second_table
WHERE contractId IN (SELECT d.ContractID FROM deleted d)
Whe...
I need to execute three dynamic SQL statements synchronously on a linked server (SQL Server 2005) like this:
declare @statement nvarchar(max);
set @statement = 'exec ' + @server_name + '.' + @database_name + '.dbo.Foo;exec ' + @server_name + '.' + @database_name + '.dbo.Bar;exec ' + @server_name + '.' + @database_name + '.dbo.BigTime';...
Hi
Currently following is the project I need to submit for my college assignment:
A vb.net chat application with a ms sql server 2k5 backend, max 100 users with file transfer, one to one and group chat facility. Admin will create chat rooms which will be password protected for group chats.
We will need to implement multithreading to fect...
I have a sharepoint server farm like the following.
Machine1: Test_DB in this machine i have installed SQL Server as named instance.
(Test_DB\sqlserver)
Machine2: Test_appsrv Application server complete installation
Machine3: Test_web in this installed sharepoint as webfront end.
In my central admin I am seeing all the ...
I cant create a new db because there are only 2 logins:
sa
BuiltIn\Users
I get permission denied when trying to create the db even though I am the admin.
How can I add a user with permissions at this point or must I reinstall?
...
I am using a SQL server table to keep related information with a URL . So there is a Column as "URL" and its type is VARCHAR . In the application we have to use this URL as a unique key to query for information (We are using something like SELECT * FROM Table WHERE URL = "www.google.com\ig")
Is there any disadvantages or known drawbacks...
I have the following SQL Server query and I am trying to get the next and previous row from a given Id. All works great unless there are two/more dates that are the same, then my logic breaks down.
If you set @currentId = 4 then I get back id 7 (it should be id 6) for the prev
If you set @currentId = 6 then I get back id 2 (it should ...
I am getting the above error when I upload my app to the hosting company.(asp.net)
DB is a local sql mdf in app_data directory.
on local asp.net dev server everything is ok.
I am using LINQ to SQL Classes, is there anything that can be related to that?
Thanks in advance
...
I having trouble creating a foreign key in sql 2005.
my primary key table has a primary key that spans 2 columns.
I want to create my foreign key so it references a column in my primary table but I want to specify a static value for the second column - is this possible?
...
What is the best way to extract date from SQL Datetime field in C#.Net?
...
Our application architecture allows us to host multiple clients in a single database, and also host multiple databases. This allows us to scale out by distributing clients across multiple databases. For example, 20 clients can be in database A, and another 15 could be in database B. We use a ClientID field in almost every table to par...
Hi all,
Well, i am tring to do something nice (nice for me, simple for you guys), i was told i can do it, but i have no idea where to start.
I have two DDL's in a page, i need on page_load to popolate both, each one gets data from deferent table with no relaition between them (suppliers/catagories). i know how to do it with two DB conne...