Viewing 15 posts - 211 through 225 (of 1,124 total)
Whenever you embed an quoted text within another quoted text, you have to add two quotes instead of one.
This statement
ISNULL( NULLIF( LTRIM( RTRIM( [state] ) ), '' ), 'false'...
May 13, 2009 at 8:06 am
Can you post the exact query that gives you this error?
May 13, 2009 at 7:58 am
Add the following in place of "state"
ISNULL( NULLIF( LTRIM( RTRIM( [state] ) ), '' ), 'false' )
May 13, 2009 at 7:46 am
There are tools available in the market such as Red Gate's "SQL Data Generator" etc. Try googling for it and I am there are many free tools available for...
May 13, 2009 at 6:06 am
sql_prodigy (5/13/2009)
so with that in mind, why...
May 13, 2009 at 6:03 am
I am glad that it worked well.
Now for the explanation, this section
FROM (
SELECT DISTINCT spaceid
FROM staging.dbo.siteownerspaces
WHERE username = @username
) O
is called as "Derived Table". A derived table is...
May 13, 2009 at 5:45 am
Check if this code works for you?
DECLARE @username varchar(30),
@s-2 VARCHAR(MAX)
SELECT@username = 'vinay@gmail.com'
SELECT@s-2 = ISNULL( @s-2 + CHAR(10) + 'UNION ALL' + CHAR(10), '' )
+ 'SELECT''' + CONVERT(...
May 13, 2009 at 5:13 am
Here is another way to do it, here it replaces the 2nd element from a delimted text with user defined fixed value...
; WITH TestData
AS
(
SELECT'234$123,N,N' AS SomeString
UNION ALL
SELECT'1545234$12,ZU,N' AS SomeString
UNION ALL
SELECT'1$2,ZU,NBCX'...
May 13, 2009 at 5:07 am
I suspect that the query is logically incorrect. Since you have declared the variable @Descricao but not assigned any value to it.
declare @Descricao as varchar(200)
select top 1 lt.txtDescricao
from...
May 12, 2009 at 9:20 am
Cross Tab or PIVOT is what you are looking for...
Here are few links that has few samples on how to do cross tab reports:
http://www.sqlservercentral.com/articles/T-SQL/63681/%5B/url%5D
http://www.sqlservercentral.com/articles/cross+tab/65048/%5B/url%5D
May 12, 2009 at 9:02 am
moojjoo (5/12/2009)
When submitted to SQL the extra characters are simply dropped [(1)What is the offical name for this?];
"Truncation"
moojjoo (5/12/2009)
What is the best practice.
Generally, its better to validate the input...
May 12, 2009 at 8:34 am
Change the 2nd statement (i.e. @r) to
set @r = 'select country,state,city from staging.dbo.[' + 'myadvertises'+ cast(@spaceid as varchar(30)) + ']'
-- OR
set @r = 'select country,state,city from staging.dbo.' + quotename('myadvertises'+ cast(@spaceid...
May 12, 2009 at 8:18 am
You can either use the un-documented procedure "sp_MSforeachdb" or dynamic sql.
--Using un-documented procedure sp_MSforeachdb
EXECUTE dbo.sp_MSforeachdb 'EXECUTE [?].dbo.SomeProcedure'
-- Using Dynamic SQL
DECLARE @sql VARCHAR(MAX)
May 12, 2009 at 8:02 am
It's either because you have not specified any value for the variable @spaceid or the 2nd statement
set @r = 'select country,state,city from staging.dbo.' + quotename('myadvertises'+ cast(@spaceid as varchar(30)),'''')
...
May 12, 2009 at 7:13 am
I just ran the code and it gives the error:
Msg 512, Level 16, State 1, Line 1
Subquery returned more than 1 value. This is not permitted when the subquery follows...
May 12, 2009 at 7:03 am
Viewing 15 posts - 211 through 225 (of 1,124 total)