March 26, 2008 at 7:48 am
I am getting a message that says my query can only be 128 characters. It is 169. Is there a way to extend it? I am using -Q command line command. It works fine on SQL Server 2000 but not on 2005.
Steve
March 26, 2008 at 7:57 am
Is using a file to hold the query to execute, and then use -i instead of -Q an option for you?
Instead of doing a cmdline query, you can save the query to file and then use the file as input.
Your friendly High-Tech Janitor... 🙂
March 26, 2008 at 8:01 am
No, it's dymanic SQL. I am getting the database file information from a given database.
SELECT FI.[filename] FROM master..sysaltfiles FI Inner Join Master..sysdatabases DB On FI.dbid = DB.dbid Where DB.[Name] = ' '
March 26, 2008 at 8:04 am
March 26, 2008 at 8:09 am
I don't think i pass the parameter, the database name, to a file.
Steve
March 26, 2008 at 8:11 am
Well, there are tricks to echo the dynamic sql to file, but then you have filesystem maintenance to include in your process(es) as well....
Other than the file trick, I think you've run out of options with sqlcmd...
It is odd that the -Q option is so 'short'.
Your friendly High-Tech Janitor... 🙂
March 26, 2008 at 9:37 pm
SW_Lindsay (3/26/2008)
No, it's dymanic SQL. I am getting the database file information from a given database.SELECT FI.[filename] FROM master..sysaltfiles FI Inner Join Master..sysdatabases DB On FI.dbid = DB.dbid Where DB.[Name] = ' '
Write a stored procedure to construct and execute the dynamic SQL from parameters, and then just exec the stored procedure from the SQLCMD passing in the appropiate parameters.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
March 26, 2008 at 10:58 pm
i tried below query having length of more than 200 characters.
C:\Windows\system32>sqlcmd -Q"select 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa11
111111111111111111111111111111111111111111111111111111'"
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
----------------
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1111111111111111111111111111111111111111
1111111111111111
(1 rows affected)
Did i miss somthing??
can you post acutal query and error message please.
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply