BCP, Tab Separated Files And Microsoft
Sep 24, 2007
Let's see, so I saved an Excel sheet in the CSV format and tried to import using BCP ... no luck, some values contain commas and there's apparently no way to force BCP to honour quotes around values with commas.
Fine, why not, let's save it as a tab separated file:
...
1000 rows sent to SQL Server. Total sent: 6000
SQLState = HY000, NativeError = 0
Error = [Microsoft][SQL Native Client]Unexpected EOF encountered in BCP data-file
6823 rows copied.
What? Unexpected EOF? 6823? There's 7162 lines of data in the file!
And if I look at the imported results ... what??? The BCP helpfully ignored the row separators and if there were too few values on a line it stole a few from the next one.
Now how the (censored) do I import the bloody data? Is BCP supposed to be used or is it just a tool to annoy people?
The params:
V:WebImport>bcp DB.dbo.TEMP_Sites in D: empActiveSites.tab.txt /Uxxx /Pxxx /Sxxx /c -e d: emperrors.csv
Thanks in advance, Jenda
(It's 12:18am and I'm getting up at 6:30. Thanks a lot mrkvosoft!)
View 20 Replies
ADVERTISEMENT
Jun 14, 2007
Do any of you know how to insert files into a Microsoft SQL DB?
Thank you,
Bassobee
View 4 Replies
View Related
Jul 13, 2006
Iam aware that Microsoft SQL 2005 Express Edition does not have agent or DTS capabilities, but how may I automate an import of flat files to the DB tables? Must I use an external VB development of is there a way to schedule an import of flat files to Microsoft SQL 2005 Express Edition ?
View 11 Replies
View Related
May 2, 2006
I'm trying in vain to upgrade sql server 2000 to 2005 with great headache and pain.
I (finally) have removed all Beta, and other incompatible version of .NET, Visual Studio and any other offending components, and made it to the first page of the install shield.
The .NET 2.0 components installed fine - but I get a fatal error trying to install the SQL Server Set Support Files.
I do have a log file - and have tired searching on the various error codes in it, but am coming up blank. Please advise - this is taking forever!
sample of error msgs in log file:
MSI (s) (B0:E0) [12:33:06:613]: Note: 1: 1935 2: 3: 0x8002802F 4: 5: CreateAssemblyNameObject 6: Microsoft.NetEnterpriseServers.ExceptionMessageBox,Version="9.0.242.0",processorArchitecture="MSIL",Culture="neutral",PublicKeyToken="89845dcd8080cc91",FileVersion="9.0.1399.0"
MSI (s) (B0:E0) [12:33:06:613]: Product: Microsoft SQL Server Setup Support Files (English) -- Error 2908. The installer has encountered an unexpected error. The error code is 2908. Could not register component {1F3316BE-825B-4390-A9D2-AF3EECCAE9F6}.
MSI (s) (B0:E0) [12:33:06:613]: Executing op: ComponentRegister(ComponentId={52723CBD-3400-458C-988A-4D012E6CAEDB},KeyPath=<Microsoft.SqlServer.WizardFrameworkLite,Version="9.0.242.0",processorArchitecture="MSIL",Culture="neutral",PublicKeyToken="89845dcd8080cc91",FileVersion="9.0.1399.0",State=3,,Disk=1,SharedDllRefCount=0,BinaryType=0)
Error 2908. The installer has encountered an unexpected error. The error code is 2908. Could not register component {1F3316BE-825B-4390-A9D2-AF3EECCAE9F6}.
MSI (s) (B0:E0) [12:33:06:629]: MSCOREE not loaded loading copy from system32
MSI (s) (B0:E0) [12:33:06:629]: Assembly Error:Function not defined in specified DLL.
MSI (s) (B0:E0) [12:33:06:629]: Note: 1: 1935 2: {52723CBD-3400-458C-988A-4D012E6CAEDB} 3: 0x8002802F 4: 5: CreateAssemblyNameObject 6: Microsoft.SqlServer.WizardFrameworkLite,Version="9.0.242.0",processorArchitecture="MSIL",Culture="neutral",PublicKeyToken="89845dcd8080cc91",FileVersion="9.0.1399.0"
MSI (s) (B0:E0) [12:33:06:629]: Product: Microsoft SQL Server Setup Support Files (English) -- Error 1935. An error occurred during the installation of assembly 'Microsoft.SqlServer.WizardFrameworkLite,Version="9.0.242.0",processorArchitecture="MSIL",Culture="neutral",PublicKeyToken="89845dcd8080cc91",FileVersion="9.0.1399.0"'. Please refer to Help and Support for more information. HRESULT: 0x8002802F. assembly interface: , function: CreateAssemblyNameObject, component: {52723CBD-3400-458C-988A-4D012E6CAEDB}
Error 1935. An error occurred during the installation of assembly 'Microsoft.SqlServer.WizardFrameworkLite,Version="9.0.242.0",processorArchitecture="MSIL",Culture="neutral",PublicKeyToken="89845dcd8080cc91",FileVersion="9.0.1399.0"'. Please refer to Help and Support for more information. HRESULT: 0x8002802F. assembly interface: , function: CreateAssemblyNameObject, component: {52723CBD-3400-458C-988A-4D012E6CAEDB}
MSI (s) (B0:E0) [12:33:06:629]: User policy value 'DisableRollback' is 0
MSI (s) (B0:E0) [12:33:06:629]: Machine policy value 'DisableRollback' is 0
Action ended 12:33:06: InstallFinalize. Return value 3.
mandpenny
View 5 Replies
View Related
Dec 26, 2007
Hi guys,
I have problems installing SQL server 2005, any help ??
Tks...
This is the log file description...
=== Verbose logging started: 25/12/2007 21:05:41 Build type: SHIP UNICODE 3.01.4000.4039 Calling process: c:Archivos de programaMicrosoft SQL Server90Setup Bootstrapsetup.exe ===
MSI (c) (AC:50) [21:05:41:656]: Resetting cached policy values
MSI (c) (AC:50) [21:05:41:656]: Machine policy value 'Debug' is 0
MSI (c) (AC:50) [21:05:41:656]: ******* RunEngine:
******* Product: {53F5C3EE-05ED-4830-994B-50B2F0D50FCE}
******* Action:
******* CommandLine: **********
MSI (c) (AC:50) [21:05:41:656]: Client-side and UI is none or basic: Running entire install on the server.
MSI (c) (AC:50) [21:05:41:656]: Grabbed execution mutex.
MSI (c) (AC:50) [21:05:41:671]: No se puede conectar al servidor. Error: 0x80040154
MSI (c) (AC:50) [21:05:41:671]: Failed to connect to server.
MSI (c) (AC:50) [21:05:41:671]: MainEngineThread is returning 1601
=== Verbose logging stopped: 25/12/2007 21:05:41 ===
View 11 Replies
View Related
Feb 13, 2008
I'm attempting to install the standard version of SQL server 2005 on XP SP2. I'm getting the following:
Errors occurred during the installation:
Error 1603 installing Microsoft SQL Server 2005 setup support files.
View 11 Replies
View Related
Jun 21, 2007
Hi
I am trying to use Association Viewer Control in
Microsoft.AnalysisServices.Viewers.DLL dll in VS 2005 but sometimes it gives an error.
"Code generatio for property 'ConnecitonManager'" failed. Error was:'Property accesor 'ConnectionManager' on object 'AssosiactionViewer1' threw the following exception:'Object referance not set to instance of an object"
Is there anyone here who use
"Microsoft SQL Server 2005 Datamining Viewer Controls" in SQLServer2005 FeaturePack ?
http://www.microsoft.com/downloads/details.aspx?FamilyID=50b97994-8453-4998-8226-fa42ec403d17&DisplayLang=en
i am using VS2005 Version 8.0.50727.762 (SP.050727-7600)
and SQL Server 2005 SP2
thanks from now.
Cem Ãœney
View 9 Replies
View Related
Jul 23, 2005
Dear All,Access adp on sql-server 2000After upgrating to A2003 updating data with 1 perticular combobox causes theprogram to hangs without any error-msg.Traying to change te combobox recordsource i get this error:This version of Microsoft Access doesn't support design changes to theversion of Microsoft SQL Server your project is connected to. See theMicrosoft Office Update Web site for the latest information and downloads(on the Help menu, click Office on the Web). Your design changes will not besaved.The solution in :http://support.microsoft.com/defaul...kb;en-us;313298tolks about SP 'dt_verstamp007' but I have SP 'dt_verstamp006'What should I do.Is the failure of the combobox also caused by the absence of dt_verstamp007???Filip
View 2 Replies
View Related
May 22, 2007
odbc_pconnect() [function.odbc-pconnect]: SQL error: [Microsoft][ODBC Microsoft Access Driver] System resource exceeded., SQL state S1001 in SQLConnect
we got the error with access 2000 database and PHP as prog. language .
we created dsn for the connection.
reboot solves the problem. but we need another solution better than this.
View 7 Replies
View Related
Sep 25, 2007
Hi,
I'm trying to install Microsoft Dynamics 10.0 with SQL 2008 Dev but when launching the utilities this returns the following error message:
******************************************************************
Your current SQL Server is not a supported version.
Req: Microsoft SQL Server 8.0
Act: Microsoft SQL Server code name "Katmai" (CTP) - 10
You need to upgrade to SQL Server 8.0 before continuing.
******************************************************************
Any ideas could help or has this if anyone knows been desinged not to work with GP10 currently?
Assad
View 7 Replies
View Related
Mar 17, 2008
I have a query that executes just fine except that it won't recognize varchar(255) ( or any other value within the () ) and if I leave it off like this: varchar, then it executes but it leaves that value as 1 and that is just not very useful for my purposes. This also happens with anything else that requires () to add length such as char(), or nvarchar(), etc... Any ideas?
View 1 Replies
View Related
Feb 5, 2004
Suppose I have a table like this
code Value
1 a
1 a
1 b
2 c
2 c
1 d
2 g
Now my require ment that I want a distinct comma separated report about these data.Means for code 1 I need a comma separated distinct values.In this case it should be a,b,d
My output should be like this
1 a,b,d
2 c,g
Can anybody help me I can I do this with the help of a cursor or any other way?
Subhasish
View 1 Replies
View Related
Jun 26, 2007
I’m passing a comma separated parameter (home, world, child) into stored procedure.
I have a Slitter function which is basically creates a table out of delimited list.
My stored procedure needs to find matched records in one of the table based on delimited list.
I have something like this:
SELECT *
FROM Word
WHERE WordName IN (SELECT * FROM dbo.fxSplitter('home,world,child, ',')
I would like to have my stored procedure be able to select rows, even if comma delimited parameter holds part of the name like this “hom, wor, chil� .
Another words it will be SELECT * FROM Word WHERE WordName LIKE '%hom%' OR WordName LIKE '%wor%' OR WordName LIKE '%chil%'
View 3 Replies
View Related
Apr 9, 2007
I would like to run more than one MDX statement in a RS2005 Report. I want to create a subcube and generate reports and then drop the subcube all from with RS2005.
View 1 Replies
View Related
Aug 26, 2006
hello all member
View 14 Replies
View Related
Jul 23, 2005
I'm not asking a lot. I just want to know if I can connect from anExchange server to a SQl server without having to use Access linkedtables. Surely MS must have had a look at this but I can't findanything out there.Help appreciated.Ginters
View 1 Replies
View Related
Jan 27, 2008
I have a checkbox list on datalist as one column. when user selects more than one checkbox and click on apply. i concatenate IDs of checkboxes as '1,2'3' for e.g. and sending that to Stroe Procedure as varchar datatype parametrer. In Procedure i wanna update status of all three selected and i am using statement "update tbl set status=1 where pageid in('1,2,3'). It is saying it cannot convert varchar to int.
How can i do this task?
Thanks in advance.
View 2 Replies
View Related
Aug 20, 2004
Hi,
****SQL Server related question.
I have a table in which one of the columns (col1) holds a string, like: 1,2,3,4,5,6,7,8,9,10
I am passing an int value (@intValue) to the sproc.
What I want to be able to do is query the table like....
SELECT * FROM myTable where @intValue .... is in col1
Any ideas?
Thanks a lot!!!!
View 4 Replies
View Related
Nov 30, 2004
Hello, I need your advice.
Here's my scenario.
Table A
------------
id name
100 apple
115 grape
125 tomato
145 melon
Table B
-------------
id Fruits
11 100, 115, 145
12 125, 115
13 100
I thought i could get the list of fruits using this statement:
select name
from A where id IN (select fruits from B where id = 11)
But apparently not, it's working if
select name
from A where id IN (select fruits from B where id = 13)
That means it does not recognize values seperated by comma. Anyone who has any idea how to make it work?
Thanks in advance.
HS.
View 5 Replies
View Related
Oct 15, 2013
I'm trying to see the following comma separated sql statement using 'print' but it is throwing error "incorrect syntax near ','".
declare @csv varchar(max)
set @csv = '535,232'
print ''Select *
from tbl
where ',' + @csv + ',' like '%,' + mainid + ',%'''
View 10 Replies
View Related
Jun 6, 2014
What the difference between the following two codes in where clause?
The both provides the same resultset for me.
alter procedure
@fieldname varchar(50)
as
begin
select field1, field2 from table1
where ',' + @fieldname + ',' like '%,' + field3 + ',%'
end
The second code :
alter procedure
@fieldname varchar(50)
as
begin
select field1, field2 from table1
where @fieldname like '%' + field3 + '%'
end
View 2 Replies
View Related
Apr 10, 2015
I have Oracle query which seperates a text with commas to column data. Can we achieve this in SQL Server?
with t as (select 'abcd,123,defoifcd,87765,aoiwerwe' as str from dual)
select level as n, regexp_substr(str,'[^,]+',1,level) as val
from t
connect by regexp_substr(str,'[^,]+',1,level) is not null;
N VAL
1abcd
2123
3defoifcd
487765
5aoiwerwe
I'm working on SQL Server 2012, Windows 7.
View 1 Replies
View Related
Feb 26, 2008
Hello. I need to write a UDF that would split a comma separated list and return 4 values. I need to return the first 4 values and ignore the commas after that. If there are no commas in the string that's passed then just return the table with empty strings. The UDF should accept 2 inputs. The ntext and a position and return a value based on the position.For example: 1,2,3,textshould createPosition | Value-------------------------1|12|23|34|textand return a value based on the position. If there are more than 3 commas for example1,2,3,This string, though short, contains a commashould createPosition | Value-------------------------1|12|23|34|This string, though short, contains a commaand return a value based on the position. And if there are are less than 3 commas in the string passedFor example: 1,2 or NULL or 2:3.5 or This is a string with no commasshould createPosition | Value
-------------------------
1| (empty string)
2| (empty string)
3| (empty string)
4| (empty string)and return a value based on the position.This is what I wrote so far. CREATE function GetValueFromPosition (@Input nvarchar(4000), @position int)Returns nvarchar(4000)AsBegin -- Declare the return Variable Declare @ReturnValue nvarchar(4000) Select @ReturnValue = LTRIM(RTRIM(member_id)) From dbo.SplitString(@Input, ',') Where position = @position Return @ReturnValueEnd CREATE Function SplitString(@text varchar(8000), @delimiter varchar(1) = ',')-- This function splits a string of CSV values and creates a table variable with the values.-- Returns the table variable that it createsRETURNS @Strings TABLE( position int IDENTITY PRIMARY KEY, member_id varchar(8000))ASBEGIN Declare @index int Set @index = -1 WHILE (LEN(@text) > 0) BEGIN SET @index = CHARINDEX(@delimiter , @text) IF (@index = 0) AND (LEN(@text) > 0) BEGIN INSERT INTO @Strings VALUES (@text) BREAK END IF (@index > 1) BEGIN INSERT INTO @Strings VALUES (LEFT(@text, @index - 1)) SET @text = RIGHT(@text, (LEN(@text) - @index)) END ELSE SET @text = RIGHT(@text, (LEN(@text) - @index)) END RETURNEND I am trying to modify these according to what I need but its not working. Please help. Thank you.
View 1 Replies
View Related
May 3, 2005
I have a table called evidence, which has the following Fields
| evidence_id | Description| Standards|
E001 blagh 1.1,1.2,1.3
Ok I am trying to search the comma-separated string in the standards field using the like clause so I can display the evidence_id.
SQL looks like
SELECT Evidence.Standards, *
FROM Evidence
WHERE (((Evidence.Standards) Like '%1.1%'));
However it will not search through the list and select for example if I change 1.1 to 1.2. The commas wont allow it.
It works if I just have one item in the list that is just 1.1. Can anyone help me to search a comma-separated string for a certain string?
Thanks
Asylum
View 3 Replies
View Related
Jan 1, 2008
Hey everyone. I've never posted on this site before so if I miss anything, please let me know.
I need to order the following data
18
14,15
13.2
14.2
15,16
15
0
14.1
12
6
15,16,18
11
16
15,17
13
14
14,15.2
17
into this order:
0
6
11
12
13
13.2
14
14.1
14.2
14,15
14,15.2
15
15,16
15,16,18
15,17
16
17
18
Because the data contains commas, I've had to change the data type to varchar. I've seen several instances of PATINDEX used however I have not ran across any of them that would put the above in the order in which I need. Btw, I have about 20 columns with this type of data and I eventually plan to use the results of each column to populate dropdownlists . Thank you all in advance.
View 11 Replies
View Related
Jul 6, 2015
I have some column values:-
employee_salary | dept
30000 1
35000 1
40000 1
I need employee-salary in one row separated by comma by executing a sql query i.e
dept1_salary
30000, 40000, 50000
View 1 Replies
View Related
Feb 14, 2015
Below is my sample data and query
declare @Sample table (ID int, message varchar(1000))
insert into @Sample(ID,message)
select 1,'Testing 1' union all
select 1,'Testing 2' union all
select 1,'Testing 3' union all
[Code] ....
I need to get top three values has to be comma separated. for example id 1 has 5 rows message which comma separated. Instead i need to consider top three message group by Id
expected result :
IDmessage
1Testing 1, Testing 2, Testing 3
2Testing 6, Testing 7, Testing 8
3Testing 11, Testing 12, Testing 13
View 3 Replies
View Related
May 13, 2008
Hello!
We are on SqlServer 2005.
Let me point out at the beginning that I don't have anyway to normalize this structure or get the admins to change the way the data is stored. We don't own the database where this is housed...we're just given the information via an .xls file...which we import to a SQLServer table.
I have some data that is given to me that has two columns (below is for an example):
Column A is an identifiying number, i.e. for a project
Column B is a comma separated list of account strings for the project
A sample layout of what we get via the .xls file might look like the following (Column A is to the left of the dashes, and Column B is to the right of the dashes):
AA.ProjectBuildTower ----- 2222, 3333, 4444, 5555
BB.ProjectBuildFence ----- X900, 6789, 9000, 9876
What I need to do is now haveprojects listed out in Column A with each of it's account strings in Column B like so:
AA.ProjectBuildTower ----- 2222
AA.ProjectBuildTower ----- 3333
AA.ProjectBuildTower ----- 4444
AA.ProjectBuildTower ----- 5555
BB.ProjectBuildFence ----- X900
BB.ProjectBuildFence ----- 6789
BB.ProjectBuildFence ----- 9000
BB.ProjectBuildFence ----- 9876
Any suggestions would greatly help!
Thanks!
View 7 Replies
View Related
Jun 7, 2008
I have the following SQL Query:
SELECT user_profiles.userFirstName, user_profiles.userInitial, user_profiles.userLastName, user_types.userTypeDesc, user_profiles.userOfficeIDs, user_profiles.userEmail
FROM user_profiles
INNER JOIN user_types ON user_types.userTypeID = user_types.userTypeID
The field userOfficeID contains a comma separated list of values such as "1,2" to identify that the user is in both the NJ and NY office.
Table office_locations
OfficeID officeState
1 NJ
2 NY
3 CT
I would like the output to be something similar to:
Name Office userOfficeIDs value
John Smith NJ 1
Mary Smith NJ/NY 1,2
Jim Smith NJ/CT 1,3
Mike Smith NY 2
Any direction would be appreciated.
Thanks
View 19 Replies
View Related
Jun 3, 2014
I just learned to use following query to convert columns to rows separated by comma.
Here is that :
Declare @list varchar(max)
select @list = isnull(@field+ ',','') + columname from table1
select @list
This produces the output I want but I'm confused with the statement. I just learnt it by heart. I don't know the meaning of it particular for the statement "select @list = isnull.............. from table1" . What exactly it does to give the desired output?
View 2 Replies
View Related
Jun 28, 2006
How to use comma separated value list in the where clause?
I would like to do something like the following (Set voted = true for all rows in tblVoters where EmpID is in the comma separated value list).
update tbl_Voters
set voted = true
where EmpID in @empIdsCsv
Where, @empIdsCsv = €™12,23,345,€™ (IDs of the employees)
Since the above is not possible I have done the following dynamic query:
-- Convert the comma separated values to conditional statement like EmpID = {id} or EmpliD = {id}€¦
set @empIdsCsv = 'EmpID=' + substring(@empIdsCsv , 0, len(@empIdsCsv )) -- Remove trailing comma
set @empIdsCsv = replace(@empIdsCsv , ',', ' or EmpID=')
declare @markVoters varchar(8000)
set @markVoters = '
update tbl_Voters
set voted = true
where €™ + @empIdsCsv
--Execute the dinamic query
exec (@markVoters)
The above code generates the following dynamic query:
update tbl_Voters
set voted = true
where
EmpID= 12 or EmpID=23 or EmpID=345
The obvious drawback here is the performance and the limitation of the dynamic query length (8000 chars).
Can someone suggest a better solution with the ability to use comma seperated values in the where clause?
View 3 Replies
View Related
Feb 24, 2007
I'm new (very new) to asp.net and now at 3am after maybe 12 straight hours of trying to go through examples and understand the syntax, I have a somewhat working program... basically a query parameters screen that upon a click generates a report. The query parameter screen basically is a HTML form with a procedure that puts the field values into session variables. The report uses <asp:sessionparameters> in the sqldatasource to apply aforementioned session variables to filter the SELECT statement's results. They are then displayed using the gridview control. It actually works!
Now I'm trying to figure out: if I need/want my users to be able to enter comma-separated list of values into the HTML form field and somehow get these into the SELECT statement's WHERE clause, is there a way to do this? I'm not very experienced with asp nor sql server and have been struggling with this new challenge. I really could use pointers as to whether there's an easy way to handle this. In other languages in the past I would have had to parse the comma-separated list and use those to construct my SELECT statement programmatically. I get the impression that with all this ASP.NET fanciness, there has to be a better way?
If it matters, I'm using ASP.NET 2.0 with SQL Server 2005 Express and Visual Studio Web 2005 Express.
Thanks in advance for any replies, they would be GREATLY appreciated :)
View 1 Replies
View Related
May 27, 2005
Hello,
I was wondering if it's possible to pass in a comma separated string
"12,14,16,18" and use it in a stored procedure with "IN" like this:
@SubRegions varchar(255) <-- my comma separated string
SELECT *
FROM myTable
WHERE tbl_myTable.SubRegionID IN (@SubRegions)
It tells me it has trouble converting "'12,14,16,18'" to an INT. :(
View 2 Replies
View Related