Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MS SQL Server & have generously sponsored dedicated servers and web hosting to ensure a reliable and scalable dedicated hosting solution for

SQL Query To Detect Non-existence Of Certain Records

 Here is my query:

SELECT     dnn_Roles.RoleName, xyzUser.FirstName, xyzUser.LastName, xyzUser.Email, xyzRewardPoint.Points, xyzRewardPoint.RewardID
FROM         xyzRewardPoint INNER JOIN
                      xyzUser ON xyzRewardPoint.UserID = xyzUser.UserId INNER JOIN
                      dnn_UserRoles INNER JOIN
                      dnn_Roles ON dnn_UserRoles.RoleID = dnn_Roles.RoleID ON xyzUser.ProviderId = dnn_UserRoles.UserID
WHERE     (dnn_UserRoles.RoleID = 3) OR
                      (dnn_UserRoles.RoleID = 4) OR
                      (dnn_UserRoles.RoleID = 6)
ORDER BY dnn_UserRoles.RoleID

What I need is to extend this query to detect any users who exist in dnn_UserRoles.RoleID 3, 4 or 6 but do not have a RewardID value of '43' in the xyzRewardPoint table.

View Complete Forum Thread with Replies
Sponsored Links:

Related Messages:
Detect Existence Of Datetime Fields
I'm looking for an efficient t-sql script to loop through all usertables in a db and determine/print the value of each row having adatetime field (including cases where there are multiple datetimefields per row)Help greatly appreciated..

View Replies !   View Related
Detect Missing Records In Flat File
I am importing records from a flat file to a database table. If a record is in the table but NOT in the flat file, I need to update a date column in the table.
Any ideas?

View Replies !   View Related
Query Analyser Does Not Check For Object Existence
we tried out the following code in query analyser -

create procedure TrialProc


select * from sakjdhf

when we executed this piece of TSQL in query analyser, we expected it to give an error or warning that no object by the name of sakjdhf exists ( as actually there is no such table or view in the database ). however to our surprise we got "command completed successfully " !!

does this mean the SQL server does not check for necessary objects when creating a stored procedure ? or is there some setting that we missed out whihch is causing SQL server to overlook the error in the code ?

View Replies !   View Related
Database Off Line; How Do I Detect With A Query
How do I detect with a query which database is off-line.And how do I detect with a query the recovery model of a database.ByeArno de Jong

View Replies !   View Related
Need Efficient Query To Partition Records By Type And Pull Top N Records From DB
I have a query similar to the following.  The intent of this query is to retrieve the top 6 records meeting the specified criteria (LOGTYPENAME = 'Process Status Start' OR LOGTYPENAME = 'Process Status End' ) based on most recent dates.  Please keep in mind that I expect to return up to 6 records for each unique LogProcessName.  This could be thousands of different LogProcessNames with up to 6 records for each.
1) The table I am executing against currently is very large in size and thus takes a long time to execute against.  It would seem there must be a more efficient query to get the results I am looking for?
2) CTE doesn't work on SQL 2000.  I need a query that does.
3) I cannot modify the database itself in the process.

;WITH cte AS (
SELECT [LogProcessName], [LogBody], [LogDate], [LogGUID], row_number()
WHERE LogTypeName = 'Process Status Start'
OR LogTypeName = 'Process Status End' ) )
FROM cte
WHERE RN = 1 OR RN = 2 OR RN = 3 OR RN = 4 OR RN = 5 OR RN = 6
ORDER BY [LogProcessName] DESC, [LogDate] DESC

Does anybody else have any idea that would yield the results that I am looking for and take into account items 1-3 above?
Thanks in advance.

View Replies !   View Related
.NET 2.0 And .NET 1.1 Co-existence?
I downloaded Quest Software's freeware version ofComparison Suite. When I attempt to install, it tellsme that it requires .NET framework 1.1.4322. I alreadyhave .NET 2.0 installed (as part of the MS-SQL native client install)and I really don't want to mess that up.Is it *safe* to have the installer download/install .NET 1.1to coexist with 2.0? Is it likely to work?

View Replies !   View Related
Checking For Row Existence
Can someone show me some C# code for detecting if a SQL row exists or not?  This seems like a very typical action and I cannot for the life of me find a tutorial online that explains this step.  In my code I'm either going to INSERT or UPDATE a record.  I tried sending a SELECT command through a ExecuteNonQuery, but only got -1 as a response.  Apparently ExecuteNonQuery does not work with SELECT.  I then saw that T-SQL has an EXISTS keyword, but I cannot see anyway to use that from within C#.So...can anyone share the typical code they use to identify if a row exists or not within a database.  I guess I was execting there to be some method available to do this sort of thing.

View Replies !   View Related
Existence Of A Value In Table

I have a table with the follwing values
Table Cats

CatID, date
Cat1,   D1
Cat2,   D2
Cat3,   D3
I just wanted to check whether Cat1 exists in the table. Can anyone post the query

View Replies !   View Related
How To Know Existence Of The Data In The Databse
Hi Friends,I have one table in the databse,i.e userTable with one field userNameIn my form I have one Label ,textbox for entering the userName and One button for submit,So I am entering the data into the table(userTable) after clicking on the submit buttonBut my problem is before entering the data into the table I want to find wheather the given data exits or notif its not exists the data has to insert into the table otherwise its has to display the message"the user is already existed"for this I wrote the code like this in C# public Boolean isUserExists()    {        SqlCommand cmduserName = new SqlCommand("select count(*) from userTable where userName= " + txtuserName.Text + ")", conn);        SqlDataReader rdr = null;        rdr = cmduserName.ExecuteReader();                 conn.Open();               int count = 0;        while (rdr.NextResult())        {            count = rdr.GetInt32(1);        }        conn.Close();        if (count == 0)        {            return false;        }        else        {            return true;        }              protected void Button1_Click(object sender, EventArgs e)    {        if(isUserExists())            {                Response.Write("Opps ! User already Exists");                                       }                SqlCommand adapInsert = new SqlCommand("insert into userName values('" + txtuserName.Text + "')",conn);        conn.Open();        adapInsert.ExecuteNonQuery();        conn.Close();        Response.Write("data inserted");       }   is it write or not because I am not getting the output .please tell me any one where I have to change the code ThanksGeeta 

View Replies !   View Related
Testing For Cursor's Existence
How is it possible to test at the beginning of a stored procedure if acursor I want to declare already exists? (So I don't cause an error bydeclaring it).ThanksBruno

View Replies !   View Related
Broadcast Existence Of SQL Server
Hi All:

Does anyone know where to find the property that disables the broadcast of the sql server from the point where you do not see the server show up in the list when one goes to

"New SQL Server Registration" -> "..."

beside the "Server" field. The dialog itself is titled "Registered SQL Server Properties". Assume both SQL Servers are both behind the firewall.

View Replies !   View Related
Co-Existence Of 6.5 & 7.0 Client Software
We are currently running MS-SQL 6.5 and are getting new apps which require 7.0.
The new apps will be on their own server(s). My question is - Can a PC run both the
6.5 client and the 7.0 client (simultaneously) to access both 6.5 and 7.0?

View Replies !   View Related
Checking For Existence Of Files
So I want to check a directory for a particular extention of file. ex: *.txt, *.zip etc. (I'm using T-SQL by the way)

I tried this:


insert #a EXEC master..xp_fileexist 'G:wklyld_SQLRMAPOLLOADUntar*.txt'

this code works as long as I give it a specific file name, but if I try the *.txt or *.zip it wont work.

I've also been trying to run


EXEC MASTER.dbo.xp_cmdshell 'dir "G:wklyld_SQLRMAPOLLOADUntar*.*"

and then copy the results to a temp table and then run queries against the table. But I havent had much luck with that either.

Can anyone help? Thanks in advance.

View Replies !   View Related
How To Check The Existence Of A Column In A Table
Dear All,


I wanted to know how do I know or check that whether a column exists in a table. What function or method should I use to find out that a column has already exists in a table.


When I run a T-SQL script which i have written does not work. Here is how I have written:

IF Object_ID('ColumnA') IS NOT NULL
        ALTER TABLE [dbo].[Table1] DROP COLUMN [ColumnA]


I badly need some help.

View Replies !   View Related
Existence Of Index For Temp Table


create table #tmp(a int)

create index idxt1 on #tmp(a)

insert into #tmp values (42)

select * from sys.indexes

where name like '%idx%'

order by name

But I can't see any rows about idxt1 :-(
If I say

create index idxt1 on #tmp(a)

againg I got error, because it exists.
How to check for existence using query?
B. D. Jensen

View Replies !   View Related
TSQL Checks File Existence?

Does TSQL provide methods to check if a file exists?

For example, a TSQL script will read data in a .dbf file into SQL Server. It will check if the file exists before read. How to do this check?

Thank you.

View Replies !   View Related
How To Check For Table Existence Before Dropping It?
Apologies if this has been answered before, but the "Search" function doesn't seem to be working on these forums the last couple of days.

I'd just like to check if a table already exists before dropping it so that I can avoid an error if it doesn't exist. Doing a web search, I've tried along the lines of
"If (object_id(sensor_stream) is not null) drop table sensor_stream"
"If exists (select * from sensor_stream) drop table sensor_stream"

In both of these cases I get the error: "There was an error parsing the query. [ Token line number = 1,Token line offset = 1,Token in error = if ]"

Sooooo... what is the standard way to check for existence of a table before dropping it? Someone help? This seems like it should be simple, but I can't figure it out.

Thanks in advance!

View Replies !   View Related
Check The Field Existence Of A Database Table
Check the field existence of a database table, if exist get the type, size, decimal ..etc attributes
I need SP
@Tablename varchar(30),
@Fieldname varchar(30),
@existance char(1) OUTPUT,
@field_type varchar(30) OUTPUT,
@field_size int OUTPUT,
@field_decimal int OUTPUT
/* Below check the existance of a @Fieldname in given @Tablename */
/* And set the OUTPUT variables */

View Replies !   View Related
Stored Procedure For Verifying Data Existence
Hello All,
I'm trying to develop a stored procedure that would do one of TWO things:
1.  Return a 'status' that a value does not exist, if I were to provide the parameter via an ASP.NET2.0 page
2.  If it does exists, to return the row data associated with that value (id number)
The stored procedure would search a SQL Server table within it self first.  It that fails it would look at an Oracle table (work order table).  And if that fails to return a 'row' to look through another Oracle table (work request table).  If that doesn't occur, then it would throw the result as described in #2.
If the result exists in one of the TWO Oracle tables it would then insert that row into the first SQL Server table that the stored procedure searched through AND would return the row set to the ASP.NET page.
While all this is happening, I was hoping to get some insight as to how to create a "Please Wait..." feedback and then moving to the final result.
Looking forward to the wise words of the many on this forum, as I have experienced in the past!  :)

View Replies !   View Related
SQL Server 2000 And 2005 Co-existence Problems
Hi,I need to maintain both SQL Server 2000 and 2005 on my PC for supportpurposes. I am using the developer additions. After I installeverything (with no install errors) I can use SQL 2005 Mgt Studio fineuntil I bring up SQL 2000 Query Analyzer or Enterprise Mgr. After that,I cannot bring up SQL 2005 Mgt Studio. It get this message:Package 'Microsoft SQL Management Studio package' failed to loadI click OK, the message comes up again, I click OK again and then MgtStudio disappears.My default instance is under SQL 2000 and I created a named instanceunder SQL 2005 on my PC both with Local System Account.My order of installs was:1) SQL Server 2000 (Server tools)2) SQL Server 2000 SP43) SQL Server 2005 (DB Engine, Integration Services, and Workstationcomponents)I also have .NET 2005 Professional installed.The frustrating thing is I can find no log information anywhere --event log, under my Documents and Settings, or in the SQL Server 2005directories where it was installed.My guess is that when I used Query Analyzer it changed a settingsomewhere or prevented me from using Mgt Studio somehow, but I justcan't figure out what it did. I'd like to avoid a complete re-installwhere it may just happen again.Any help would be appreciated. Thanks much.Tom Vicker

View Replies !   View Related
Checking For Existence Of A Temp Table Before Droping It
I'm familiar with how to check for the existence of a table before dropping it using the following command:

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[xxx]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[xxx]

How does one check for the existence of a temp table (using # syntax) before dropping it? I've tried various flavors of this command and none work. One flavor is

use tempdb
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[#xxx]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[#xxx]




View Replies !   View Related
Function To Check The Existence Of A Temp Table
This function, F_TEMP_TABLE_EXISTS, checks for the existence of a temp table (## name or # name), and returns a 1 if it exists, and returns a 0 if it doesn't exist.

The script creates the function and tests it. The expected test results are also included.

This was tested with SQL 2000 only.

if objectproperty(object_id('dbo.F_TEMP_TABLE_EXISTS'),'IsScalarFunction') = 1
begin drop function dbo.F_TEMP_TABLE_EXISTS end
create function dbo.F_TEMP_TABLE_EXISTS
( @temp_table_name sysname )
returns int

Checks for the existence of a temp table
(## name or # name), and returns a 1 if
it exists, and returns a 0 if it doesn't exist.


if exists (
select *
tempdb.dbo.sysobjects o
o.xtype in ('U')and = object_id( N'tempdb..'+@temp_table_name )
begin return 1 end

return 0

print 'Create temp tables for testing'
create table #temp (x int)
create table ##temp2 (x int)
print 'Test if temp tables exist'

[Table Exists] = dbo.F_TEMP_TABLE_EXISTS ( NM ),
[Table Name] = NM
select nm = '#temp' union all
select nm = '##temp2' union all
select nm = '##temp' union all
select nm = '#temp2'
) a

print 'Check if table #temp exists'

if dbo.F_TEMP_TABLE_EXISTS ( '#temp' ) = 1
print '#temp exists'
print '#temp does not exist'

print 'Check if table ##temp4 exists'
if dbo.F_TEMP_TABLE_EXISTS ( '##temp4' ) = 1
print '##temp4 exists'
print '##temp4 does not exist'

-- Drop temp tables used for testing,
-- after using function F_TEMP_TABLE_EXISTS
-- to check if they exist.

if dbo.F_TEMP_TABLE_EXISTS ( '#temp' ) = 1
print 'drop table #temp'
drop table #temp

if dbo.F_TEMP_TABLE_EXISTS ( '##temp2' ) = 1
print 'drop table ##temp2'
drop table ##temp2

Test Results:

Create temp tables for testing
Test if temp tables exist
Table Exists Table Name
------------ ----------
1 #temp
1 ##temp2
0 ##temp
0 #temp2

(4 row(s) affected)

Check if table #temp exists
#temp exists
Check if table ##temp4 exists
##temp4 does not exist
drop table #temp
drop table ##temp2


View Replies !   View Related
Checking Existence (repeating) And Output Count??
Hi All,

Not played with SQL for a while and am a bit rusty so please excuse me if I sound like a demented idiot! )

It's for a data migration from something wierd to SQL, I just need to be able to advise whether a table is worth migrating or someone should manually enter the data (i.e. if only six random fields are populated in a table then get a secretary to enter it).

I was hoping someone might have already done this and have a query I can edit?!

As far as I can make out the query needs to loop through every table, loop through every row, check each field for an existance of data and output something useful.

I've stared at this for about 3 hours now and tried several different things and none work.....and it's doing my nut! (



View Replies !   View Related
How To Check For A File Existence In A Folder In SSIS
I have a data flow task inside a foreach loop container which will take multiple excel files and load into a sql table. Once all the excel files are loaded into the table, then at the end one of the column gets updated using execute sql task. Now I am trying to check for a file existence, if the file is not present in the folder then the data flow task should not be executed. Any help is greatly appreciated, I am thinking of using file system task for this, but not exactly sure. Thanks in advance.

View Replies !   View Related
Checking For Existence Of File Fails During Validation
OK.  Here's my situation.  I check for the existence of a dummy .txt file using a script.  I send an e-mail if it does not exist and exit package.  The .txt file only exists if another .xls file is present which I import.  However, during the validation phase of the package, the package fails because the .xls file does not exist.  Is there a way to bypass the validation step?  The only solution I came up with is to have a two-step job.  The first runs the file check step and sends the e-mail.  The second attemps to run the package and fails.  Not a very graceful exit.

View Replies !   View Related
Co-existence Of Log-Shipping And A Independent Backup Strategy
We have a critical Production database on which we want to setup Log-Shipping. We have also purchased the Symantec NetBackup utility for taking Backup to Tape Drives.
We Know that there are some inherent problems with using Log-Shipping and a Backup Strategy together, and thus we were finding out various ways in which we can run both in tandem.
One of them was taking the Symantec Log backups with Copy-Only option.
The main problem with this is that the Symantec Backups becomes dependent on the Log-Shipping Backups and also most of their Log-Backups become useless. Also, we are not sure whether the utility allows Copy-Only backups
The second alternative was to disable the Backup job of Log-Shipping on the Primary Server and to use the Log-Backups done by the Symantec utility for performing the Restores on the Secondary.

Thus, if Log-Shipping is scheduled to run say every 4 hrs, and the Symantec Log-backup happens every 1 hour, then at an interval of every 4 hrs, the Restore Job on the secondary will pick up the 4 backups done by the Symantec Backup utility and Restore each one of them in sequential manner.
But, I guess it is not easy to have a manual Restore Policy in place.
I was really banking on this solution until I found that the Restore Job of the Log-Shipping setup is dependent on the Filename of the Transaction log file which the systems generates automatically, and it won€™t be easy to create a customized Restore Job on the secondary server which takes in all the Log Backups generated by the Symantec Backup utility and Restore the Secondary database.
Have any one of you ever face this issue? Would like to know what is the best way to keep both of them running together.

View Replies !   View Related
Select Backup Location -- Cannot Verify The Existence
When attempting to backup a database using Management Studio, I receive a ""Cannot verify the esistence of the backup file location. Do you want to use the backup file location anyway?" yes/no messsage afer entering a file directory which exists.  When entering a new directory, when I select "yes," a file locaiton will not be created, however, the backup operation continues to success.  Originally, I had configured the  sql services to execute under a user account with domain admin and administrative privledges, and I vverified the folder's security config permited write access.  I reinstalled and now al SQL services are executing as "Local System" (or "Network Service") with same problem.
Any recommendations as to how to correct what I am doing wrong?  (Thanks).
SQL Server Enterprise 2005 running w/all patches on Windows Server 2003 Server.

View Replies !   View Related
Point Of Information - Checking For Existence Of A Table In Another Database...
Hi all,

While cleaning up some code, I ran across the following statement in a stored proc - the purpose of which is to determine if a table exists in the local database: SELECT * FROM dbo.sysobjects where id = object_id(N'[dbo].[XML_PRINTDATE]') and OBJECTPROPERTY(id, N'IsUserTable') = 1of course I removed it from the IF just for testing purposes, but my quandry is this...
Why chose that select (converting table name to object ID) rather than just doing THIS:SELECT * FROM dbo.sysobjects where name = N'XML_PRINTDATE' and OBJECTPROPERTY(id, N'IsUserTable') = 1

I first thought it was to gain access to the "id" column value (and that may yet be the purpose of it), but the second code seems to work just peachy (I assume because the id column is present in the sysobjects table itself).

A follow-on question is this:
When I try to do the same check from another server (i.e.SELECT * FROM APRECEIVE1.DailyProd.dbo.sysobjects where name = N'XML_PRINTDATE' and OBJECTPROPERTY(id, N'IsUserTable') = 1) it of course fails because OBJECTPROPERTY only looks for the id on the local database.

So, do I CARE if it is a user table? (I am reasonably sure it is, of course) and if so, is there a way to check on the remote server for the object type?

Bottom line is I Think I can just simplify things and check for the object name on the remote server, but just don't want to take away any "warm fuzzy feeling" generated by the original stored proc, if such a warm fuzzy is of any benefit (though don't get me started on the relativity of warm fuzzies, I wrote my Thesis on that ;) )

View Replies !   View Related
ERROR! - Unable To Verify Existence Of File Location
I am trying to create a backup device on a remote share (seperate domain).
The share I have created is set up with full control permissions to everyone and the NTFS folder permissions are also set to this. I have no problems browsing through NT.

I get the following error message:

Unable to verify existence of backup file location. Do you want to use the backup file location anyway?

I only seem to experience the problem with this server. I can create backup devices to other shared folders on other servers.

Does anyone have any experience of this or ideas on how to resolve it?

Thanks in advance.

View Replies !   View Related
Exec SSIS Package Based On A File Existence
I am not sure if we can execute SSIS package using t-sql, but I want to do the following:
Step1. Execute SSIS package1
Step2. Check for the file1.txt in c drive using the below code:
Declare @result int
exec xp_fileexist 'c:file1.txt', @result output
IF (@result = 1) --if file exists exec ssis package
Execute SSIS package2

If we can't use t-sql, please let me know how I can do that as part of sql job. Thanks!!

View Replies !   View Related
Triggering SSIS Package Based On A File Existence
I am trying to trigger SSIS package if a file is present in a folder, can I use any of the SSIS tasks in doing that??

View Replies !   View Related
Triggering SSIS Package Based On A File Existence
I am trying to trigger SSIS package if a file is present in a folder, can I use any of the SSIS tasks in doing that??

View Replies !   View Related
Checking For Existence Of Parent Variable In Child Package
I have a parent package that calls a child package, when I run the parent package the child package picks up a variable value from the parent in a script task and runs fine, the problem I'm facing is when I run just the child package, the script task fails because it doesn't know about the parent variable.  The dilemma I'm facing is in my child script task, if I add the parent variable to the ReadOnlyVariables list then the task fails because the parent variable doesn't exist when I just run the child.  If I don't add the parent variable to the ReadOnlyVariabls list then if I try to use it then the task fails saying that the variable doesn't exist in the variables collection. 
Is there a way to check for the existence of the parent variable, so when I just run the child package I don't get an error and I don't have to change my task every time I choose to run the child package only vs running the parent/child?

View Replies !   View Related
How To Make The SSMSE To Return Whole Records Without Any Close Query Form And Re-create Query Form Operation?
I got a problem.
I installed Microsoft SQL Server Management Studio Express 2005 version.
And I created a Compact database.
I created an connection in SSMSE to connect the database and opened a query form.
then, i run the following sql:

Select * from Table1

It returned 3 records to me.
After that, I used program to insert record into this table.
Then i ran this sql again, it still show me 3 records.
I closed the query form, and re-created a new query form, then run the sql, it returned 4 records to me.

Why?  It's very strange and difficult to operate, right?
Is there anyone know how to make the SSMSE to return whole records without any close query form and re-create query form operation?

Thanks a lot!

And Merry X'max!!!

View Replies !   View Related
If/else Newbie Question (conditionalizing SELECT On Old/new Db, Existence/abscence Of A Column)
As to not get lost in the details of my problem, I'm oversimplifying this posting to get the root of my problem answered. :-)

Let's say a database has a table called CUSTOMERS, and it may or may not contain a column called ORDER_NUMBER, depending on whether or not the database is an old or new database.

Now if I run the following query in Query Analyzer (v8)...

if (1=2) begin
    select * from CUSTOMERS where ORDER_NUMBER is not null

...I get "Invalid column name 'ORDER_NUMBER'."

Obviously 1 does not equal 2, so why is the code in that if block being executed?  Or is there some sort of precompilation/schema checking that is going on which is causing the error?  If so, can I set something to not have the code be precompiled?

View Replies !   View Related
Question ... How To Test/verify Existence Of Local File Or Folder Using T-SQL (2005)?
Two questions actually ...
1) Need a simple routine or system function for testing for or verifying the existence of a file or folder on the local server's file system. Returning a simple boolean value or 1 or 0 would be fine.
2) Need a syntax and use description of the new "master.dbo.xp_create_subdir" function ... anyone have some documentation or links? MS technet and MSDN have nothing.

View Replies !   View Related
Problem: Must Detect Db Changes
HelloI´m using MS-SQL Server 2k with a custom application connecting to it.I need a quick and simple way to detect any change (insert, update, delete)to my database (not just to a single table). The purpose is to notifysomehow different instances of the application about the data changes,since they should refresh their local query results.Is there any function, stored procedure, system database entry, etc. I canexploit to get the job done? Can you suggest me the most suitable mechanismto implement this?T.I.A.AndreA

View Replies !   View Related
How To Detect *.cer Association
I am entering to administration of
 SS2005 SP1 (Windows 2003) having files mdf, ndf, ldf in
C:Program FilesMicrosoft sql serverMSSQLData
This dir also has two  *.cer files.
Apparently no encryption is used

How can I get known what these *.cer files are for?

View Replies !   View Related
Detect Licensing

I am trying to find out if versions of SQL SERVER 2005 we have installed have full or Developer Licenses.

They were installed previously by someone who no longer works here, and we do not the versions on record.

We have enough full licenses, so we just want to make sure the correct ones are set up on our servers.

Anyone know how/where we can find this information?



View Replies !   View Related
Comparing 2 Records SQL Query
Hey Guys, I have a contacts table that contains          ID, First Name, Last Name, and Phone Number, Date Entered, Changed. Every time, the data is modified and saved, it will insert a new record in the table. So, Ill create a new record for a contact named Ryan, and then come back a day later and update the last name and phone number. So theSQL table would look like...1   Ryan   Scott  818-550-0000  05/08/2008   Null2   Ryan   Peters  000-000-0000  05/09/2008   Null How do I write a  sql query that will run an update after the insert of the second record to fill in the Changed field with the data that changed?So I want to have record 2, end up looking like this... 2   Ryan   Peters  000-000-0000  05/09/2008   LastName,PhoneNumberAny ideas? 

View Replies !   View Related
How To Query For Records That Have Not Been Replicated
Hi,I am using Merge Replication for synchronizing a bunch of laptopsrunning MSDE with a central SQL Server 2000 production server.This database is used by an application that needs to know whichrecords have not yet been replicated, at any givem time.Here's a simple scenario:User A in laptop X starts his copy of the application. He syncs hisMSDE database through the application, to match the current centralservers' data. He then proceeds to add new records through theapplication and, after he is done, he synchronizes his database withthe central server, through the application.At any given time, the user might kill the application. He might addsome records today, a few more tomorrow or in a week and should be ableto change and delete records that have not yet been merged into theproduction server.The problem is that SQL Server does not have an easy way to tell whichrecords in the subscription tables have been inserted but not yetreplicated. I have been using the following query:SELECT rowguidFROM [MyTable]INNER JOIN (SELECT rowguid AS rep_idFROM msmerge_contentsWHERE generation = joinchangegen AND generation = (SELECT MAX(generation)FROM msmerge_genhistory )) dtableON rowguid_rep = dtable.rep_idThis query works for most cases but fails to identify the first recordcreated immediatly after a synchronization event.What I would like to know is if there is a correct way of identifyingrecords which are "not-yet-replicated" on a given table that is part ofa merge replication process like the one described above.Thanks in advance.

View Replies !   View Related
How To Get Last Records In Grouped Query.
Hi,I want to create query where I could group records by quarters, and getthe last record in each group.e.gCreate Table MyTable(Value [float],date[datetime])Insert into MyTable (value, [date]) values (100, '1-1-2000')Insert into MyTable (value, [date]) values (110, '1-2-2000')Insert into MyTable (value, [date]) values (120, '1-3-2000')Insert into MyTable (value, [date]) values (130, '1-4-2000')Insert into MyTable (value, [date]) values (140, '1-5-2000')Insert into MyTable (value, [date]) values (150, '1-6-2000')Insert into MyTable (value, [date]) values (160, '1-7-2000')Now I would like to get this data grouped by quarter, and get the lastvalue from each quarter. So here I would like to get result like this(120, q1 -2000)(150, q2 -2000)(160, q3 -2000)I know how to create aggregate functions but I have problem with gettingthat last record from each group.*** Sent via Developersdex ***

View Replies !   View Related

Copyright © 2005-08, All rights reserved