Well, I've been able to get the work around to return correctly. The above does do the same thing. It's just that my real statement is MUCH longer and my error was occuring when writting the XML string to a variable.
Apparently you can SET a variable to an XML string in 2005, but not so in...
...Unfortunetly, I don't have the flexibility to change the attributes in anyway.
I thought I figured out a way. By doing this:
SELECT *
FROM Customers
FOR XML AUTO, ELEMENTS
It worked fine independently, but when I run it in my script I get "Incorrect syntax near 'XML'."...
...RAW with ELEMENTS.
I am reverse engineering an app and I need to be able to produce results as they would appear if I was doing this:
SELECT *
FROM Customers
FOR XML RAW('Customer'), ELEMENTS
But, my DB is a 2000 server, not a 2005.
Ideas on how to change this FOR XML...
Thanks SQLDenis.
I've actually been hunting for a download page for SSIS with no luck yet...
SSIS might not be an option for us though, as we may be moving away from SQL Server in the near future. So, implementing something that could be time consuming isn't really practical.
I think we...
I'm looking for some other way to write the data set from a stored proc out to a file. I've always used bcp, and have never found or known of another utility.
We have users who pick up the files that our stored proc write out with their automated processes to load the data into their systems...
I've had a lot of issues with bcp in SQL Server 2005 - the data will often not sort correctly even when using the ORDER hint. Anybody know of an alternative to bcp?
thanks!
-MK
Thanks for the reply Phil and SQLSister.
The table (temp table) is built dynmically to accomodate data from a pivot table whose columns are created dynamically. The data will always be varchar(25).
I extrapolate the columns from the query (date ranges with sums in the pivot) so the columns...
Is it possible to do an insert by column number???
Like... INSERT INTO tabname 3 VALUES('some insert')
--> 3 being the column number
Thing is, I've got a stored procedure that builds a table dynamically. I need to insert a value into the table but I can't do a simple insert because the number...
Thanks ESquared!
I was thinking something similar to that too.
If I could get the count of the number of lines in the file, I could set LASTROW = that number - 5 (5 being the static rows at the end of the file).
But, I haven't figured out how to do that yet. :(
I'm going to try to get one of...
Thanks Phil!
Not to sound too green, but what would I use to strip out lines in a file? Is there a way to do this from within SQL Server?
Thanks again!
-MK
Hello all!
I am writing a BULK INSERT statement that loads a variable length file that I receive daily. However, the last lines of this file contain a few lines of HTML that is causing the BULK INSERT to fail. Is there a way I can have BULK INSERT load all records and stop when it sees a certain...
Thank you!!!
Exactly what I was looking for!
For others: here's a query to grab the column and table name.
select sysobjects.name TableName,
syscolumns.name ColumnName,
sysproperties.Value ColumnComment
from syscolumns
inner join sysproperties
on...
Anybody know which system table contains the actual comments for tables? I can find stored procedure text and column defaults in syscomments, but not the actual attribute's comments.
Ideas?
Thanks!
-MK
I found a good article:
http://vyaskn.tripod.com/differences_between_set_and_select.htm
It talks about doing this:
SELECT @Variable1 = 1, @Variable2 = 2
But, can you do something like that with a WHERE clause?
Humm....
Call me lazy... BUT, Is there any way to make this one assignment statement:
DECLARE @Variable1 int
DECLARE @Variable2 int
DECLARE @Criteria int
SET @Criteria = 123
SELECT @Variable1 = (
SELECT Field1
FROM Table
WHERE SearchField = @Criteria )
SELECT @Variable2 =...
Jay, thanks for the response! It is the same database.
Nigel, YES! I wasn't paying attention to the data type before. That explains it. Thank you!
Explanation: The field is an nvarchar field (not sure why it was created as a unicode data type, but it is). A unicode data type takes up twice as...
...it was varchar(100). Hummm….
So, I run sp_help again just to make sure I'm not delirious, and sure enough it says the length is 100. I do: select * from syscolumns where name = Field1 and the length listed in syscolumns is also 100. Then I look at the table design in Enterprise Manager and...
Thanks for the response! Sorry for the delay! My problem did originate from not having the remote server set up in linked servers. Works wonderfully now.
Thanks again.
-MK
...DB
2. Perform an INSERT with data from the local DB into the remote DB using that MAX value in the WHERE clause
Code:
DECLARE @MaxValue int
/************************************************* Grab value from remote server
***********************************************/
SELECT @MaxValue =...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.