I am trying to obtain data from CSV file (in Excel) to SQL Server table using Openrowset command. There is one issue I am facing The columns which have blank values in the first 20 records and then only has a proper value in the 21st record are not getting imported correctly. For such columns, I get a NULL for the proper value as well. I need to proper value to come. Any suggestion?
I'm using sql server 2005, I created a customer table and set the customer_id as an uniqueidentifier that is a NEWSEQUENTIALID()...when a user is created I want to obtain the last customer_id so that I can insert it in another table that has a one to many relationship with the customer table. Please help...how do i do this?.Thanx
I'm working on a search engine right now, and I am querying out a set amount of information at one time. How can I grab the last row count of a query, and use that as a starting point, or index when a "Next 100" is pressed. For instance, a person searches through a user table, but only wants 25 users at a time. So the beginning index is 0 to 25. In my query, I have "SELECT TOP 25 from users", but now when the person searching want's to move to the next 25 users, so the index would be 26 to 50, how can I hold the last row displayed? It gets a little more complex also, if a user is searching by last name, the rows will be staggered. Is there a SQL function which will grab the number of the last row displayed? I've looked through the SQL Book, and was unable to find a function that does this, or anything close to it. I hope I made sense of this question, if you need more information, email me and I will try to clarify. Thank you for any information or hints.
If I have say 20 records of sales employees, for example, how can I get the top 3 locations for $$$sales for EACH employee? Each employee can have multiple locations where they have sold(let's say up to 50). I only want the names of the top 3 locations. The closest I can get is filtering the dataset by a HAVING clause > a dollar amount but this still gives me between 3 - 12 records for each plus I have to literally enter each salesperson's number as it stands now. Is this a loop or a cursor? Thanks.
i need to run a restore of a database overnight onto a different server using the live data .bak file. however the job failed on the first run (last night) with the error:
"Exclusive access could not be obtained because the database is in use. ...."
how do i gain this Exclusive use via an SQL statement please?
I have a new computer, clean, I installed WinXP, and I want to connect a SQL Server (other computer in the same network) For this I installed the client tools from SQL SERVER 2000 kit. Ok. When I try to connect to the server, I can't connect through "trusted connection", only whit user name and password. I mention that I set the sql server in mixed mode autentification.
When I try to connect from other computer (my laptop, or other computer from this network) I can connect both types of connection: trusted and with
sa (for example)
The question is:
How I can set up a "trusted connection" at SQL Server?
The computer is completely new, clean and has win xp with sp2.
I have a new computer, clean, I installed WinXP, and I want to connect a SQL Server (other computer in the same network) For this I installed the client tools from SQL SERVER 2000 kit. Ok. When I try to connect to the server, I can't connect through "trusted connection", only whit user name and password. I mention that I set the sql server in mixed mode autentification.
When I try to connect from other computer (my laptop, or other computer from this network) I can connect both types of connection: trusted and with
sa (for example)
The question is:
How I can set up a "trusted connection" at SQL Server?
The computer is completely new, clean and has win xp with sp2.
i need to programmatically obtain and the process constraintinformation. the problem with the output from sp_helpconstraint isthat it outputs two resultsets. (the 2nd resultset is exactly what ineed though)as far as i know i can't stick this output into a temp table to thenprocess with cursors or anything like that. i'm trying to directlyaccess all kinds of sytem tables but not getting the complete info thatthe 2nd resultset that sp_helpconstraints offers.(E.g. sp_helpindex is more useful as it outputs only one resultset ofinformation so i could programmatically use that output to do what ineed to do)any suggestions? thanks.
i need to programmatically obtain and process constraint keyinformation. the problem with the output from sp_helpconstraint isthat it outputs 2, and sometimes 3 resultsets. (the 2ndresultset/constraint_keys is exactly what i need however)because the resultsets vary in output format, i cannot programmaticallyuse the output to process in my DB proc. its essentially useless tome. i can only suppress the 1st resultset (with tablename info), andcannot suppress the occasional 3rd resultset (that has referencingforeign key info).i've tried to directly access all kinds of sytem tables but i'm notgetting the complete info that the 2nd resultset thatsp_helpconstraints offers.any suggestions? thanks.
Sorry for my englishI have a table that contains data of career about the person (staff)like this ...EMATREANIDEMEIDEGIIDecc. ..ecc. ..ecc. ..ecc. ..1199912312002123111200311000321999123120021231122003110003419991231200073115199912312001131161999123120021231162003110003719991231200212311whereEMATR is a not unique key (person ID)EANID, EMEID, EGIID (assembled) are the date of the last advance ofcareerI want extract from the table below only the actual position,therefore a view that return this rowsEMATREANIDEMEIDEGIIDecc. ..ecc. ..ecc. ..ecc. ..1200311000322003110003419991231200073115199912312001131162003110003719991231200212311I hope of to have been explainThank you from Maximiliano (italy)RE-Sorry for my english--Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
i read from msdn that i need a certificate for me to be able to configure SSL which will allow me to replicate on my publication. it says that i can obtain a certificate from a certification authority (CA). do i have to pay for it?
there is a SelfSSL that i can dowload and use for 7 days have anyone of you tried this before?
I need to be able to obtain the storage space used for database log files through T-SQL commands. I can do this in version 6.5 but have been unable to accomplish this in version 7.0. Does anyone have a suggestion?
I need to be able to obtain the storage space used for database log files. I can do this in version 6.5 but have been unable to accomplish this in version 7.0. Does anyone have a suggestion?
I'm trying to devise a query for use on SQL Server 2000 that will dowhat was previously done with one query in MS Access. The MS Accessquery was like this:SELECT Count(*) as [Opened],Abs(Sum([Status] Like 'Cancel*')) As [Cancelled]FROM Detail_Dir_LocVWhere (Detail_Dir_LocV.DateOpened > '2004-8-01') andStatus not like 'Deleted'Group By Year(DateOpened), Month(DateOpened)Order By Year(DateOpened), Month(DateOpened)Here were I'm at with SQL Server, TSQLSelect Right(Convert(Char (11), Min(DateOpened), 106), 8) as [MonthOpened],Count(Status) as [Opened]FROM Detail_Dir_LocVWhere (Detail_Dir_LocV.DateOpened > '2004-8-01') andStatus not like 'Deleted'Group By Year(DateOpened), Month(DateOpened) Order ByYear(DateOpened), Month(DateOpened)Which yieldsMonthOpened======================Aug 2004503Sep 2004752Oct 2004828Nov 2004658Dec 2004533Jan 2005736Feb 2005707Mar 2005797Apr 2005412AndSelect Right(Convert(Char (11), Min(DateOpened), 106), 8) as [MonthOpened],Count(Status) as [Cancelled]FROM Detail_Dir_LocVWhere (Detail_Dir_LocV.DateOpened > '2004-8-01') andStatus like 'Cancelled%'Group By Year(DateOpened), Month(DateOpened) Order ByYear(DateOpened), Month(DateOpened)Which yields;MonthCancelled=========================Aug 200478Sep 2004105Oct 2004121Nov 2004106Dec 200475Jan 200582Feb 200571Mar 200594Apr 200533What is desired isMonthOpenedCancelled============================Aug 200450378Sep 2004752105Oct 2004828121Nov 2004658106Dec 200453375Jan 200573682Feb 200570771Mar 200579794Apr 200541233Any assistance would be appreciated.Cheers;Bill
Hi all,I need to be able to obtain the full contents, i.e. sql statementsinside, of all procedures in SQl Server 2000. I am using MS type 4JDBC driver. I know that from the database metadata, I could get thenames of all stored procedures and their column structures. However,I did not find any thing that will help me to obtain contents of thestored procedures. Any help would be very much appreciated. Thanks:-)) Vien Nguyen
I know the default data path on a SQL7 server is defined in theregistry key SQLDataPath. I want to be able to determine the defaultdata path in a VB.NET application on the local machine and remotemachines. Is using the Registry Class the best way to do that or isthere a SQL command that can tell me? I have read about xp_regread butI can't find it documented anywhere and I do not know what parameterlist it is expecting. I thought this path may be in an InformationSchema view, but I can't find it.Thanks for any help.
I have created a linked server that connects to "mpp" file, and it connects and opens successfuly returning a list of tables that exists in the linked server to the mpp file.
But the problem i am facing now that whne i write a select statment to get data from the tables in this linked server
select * from linktompp.testmpp.dbo.tasks
such that linktompp is the linked server name
testmpp is the catalog name
tasks is the table name i need to select data from
it shows an error that says
"Could not obtain a required interface from OLE DB provider 'Microsoft.Project.OleDB.11.0'."
"[OLE/DB Provider 'Microsoft.Project.OleDB.11.0' IUnknown::QueryInterface returned 0x80004002: IGetDataSource]"
I see others having this problem when trying to run a query across a link from 2005 to a 2000 server. But we are already running SP4 on our 2000 server. What gives?
OLE DB provider "SQLNCLI" for linked server "s-1" returned message "Unspecified error".
OLE DB provider "SQLNCLI" for linked server "s-1" returned message "The stored procedure required to complete this operation could not be found on the server. Please contact your system administrator.".
Msg 7311, Level 16, State 2, Line 5
Cannot obtain the schema rowset "DBSCHEMA_TABLES_INFO" for OLE DB provider "SQLNCLI" for linked server "s-1". The provider supports the interface, but returns a failure code when it is used.
We recently bought a new (sql) database server with 8 gb ram. I started moving the databases from our older 2005-sql to the new one. Everything goes well, except...
Some steps in our jobs do a truncate table of a delete from... When the job is running and it reaches the step where the truncation/deleting starts, it stops its execution and gives the following error :
Code Snippet
The instance of the SQL Server Database Engine cannot obtain a LOCK resource at this time. Rerun your statement when there are fewer active users. Ask the database administrator to check the lock and memory configuration for this instance, or to check for long-running transactions. [SQLSTATE HY000] (Error 1204). The step failed.
When I try to execute the procedure that does the truncation manually, it works perfect. Do you guys have an idea on what the cause of this error might be ?
Thanks a lot in advance !
(FYI: we use the enterprise edition of sql server 2005)
ResultSetProductos = ComandoCargaProductos.ExecuteResultSet(Data.SqlServerCe.ResultSetOptions.Scrollable Or Data.SqlServerCe.ResultSetOptions.Updatable)
End Sub
And I want to obtain the schema of the table which my resultset is pointing
Dim tabla As Data.DataTable
tabla = Me.ResultSetProductos.GetSchemaTable
But the datatable that i obtain donīt seem to have the schema that i need, for example donīt have the primary keys i have define and also donīt have any constrains......
Hi to all, is my first post, i need a query or script to obtain all users and privileges from all my databases, someone to help me. I'm learning Administration SQL server 2005.
I know that sys.database_principals and sys.server_principals have information about that, but i need users - privileges of every database.
All of a sudden I have 4 of my databases, including pubs that are all marked suspect and seem to be un-recoverable. I have followed the Resetting the suspect status directions as well as trying to attach only the .mdf files but still run into problems reading the .ldf file. I have not tried to do the procedure of creating another database with the same name and structure then swapping the files to trick SQl but will do so if I need to. Does anyone know why this happens all of a sudden to multile databases, of which Pubs I have never used for anything??
In my log files during startup I get this error
Failed to obtain TransactionDispenserInterface: Result Code = 0x8004d01b
Then this error for every database that is suspect, (the actual LSN numbers are different for each one).
The LSN (4:517:1) passed to log scan in database 'pubs' is invalid.. Is there anything else I can do to prevent this from happening or recover the DB's