Jump to content

Ms Sql Server Technology Discussions


9Pardhu

Recommended Posts

[quote name='deals2buy' timestamp='1354737407' post='1302901172']
urgent help kaavali vayya...evaraina online lo unte reply ivvandi koddiga
[/quote]
cheppu endi??

Link to comment
Share on other sites

[quote name='DARLING...' timestamp='1354739640' post='1302901429']
cheppu endi??
[/quote]


Two tables unnayi...

Table1:
ID, City

Table2:
ID, Start_Date, End_Date, City


Table1 Data ila undi:

1 NewYork
2 Chicago
3 Los Angeles


Table2 Data ila undi:

1 2012-09-01 2012-10-31 NewYork
1 2012-11-01 2012-12-31 Boston
2 2012-09-01 2012-12-31 Chicago
3 2012-09-01 2012-12-31 Los Angeles




Ippudu nenu Table1 lo unna ID1 ki Boston ani update cheyyali based on the max End Date of Table2


ela cheyyalo ardham kaavatam ledu...

ee error vastondi
Msg 147, Level 16, State 1, Line 1
An aggregate may not appear in the WHERE clause unless it is in a subquery contained in a HAVING clause or a select list, and the column being aggregated is an outer reference.

Link to comment
Share on other sites

[quote name='deals2buy' timestamp='1354740650' post='1302901545']


Two tables unnayi...

Table1:
ID, City

Table2:
ID, Start_Date, End_Date, City


Table1 Data ila undi:

1 NewYork
2 Chicago
3 Los Angeles


Table2 Data ila undi:

1 2012-09-01 2012-10-31 NewYork
1 2012-11-01 2012-12-31 Boston
2 2012-09-01 2012-12-31 Chicago
3 2012-09-01 2012-12-31 Los Angeles




Ippudu nenu Table1 lo unna ID1 ki Boston ani update cheyyali based on the max End Date of Table2


ela cheyyalo ardham kaavatam ledu...

ee error vastondi
Msg 147, Level 16, State 1, Line 1
An aggregate may not appear in the WHERE clause unless it is in a subquery contained in a HAVING clause or a select list, and the column being aggregated is an outer reference.
[/quote]



Update T1
Set T1.CITY = T2.city
From T2
Where T1.ID = T2.ID And T2.startdate = (Select MAX(T2.startdate) From T2
Where ID = 1)

This will Work

Link to comment
Share on other sites

SQL server babulu evarina oline lo unnara...

SSRS report lo oka issue undi...?


Daatset lo SP use chestunna in the report

So Report run chesthe time out issue vastundi in the report

Where as management studio lo SP secs lo run avtundi...

Y I am getting error in the report. Dataset refresh chesina same prob vastundi...report run chesina same prob chupistundi..Dhiniki akranam em ayyundachu..?Wt shuld I do rey

Link to comment
Share on other sites

[quote name='DARLING...' timestamp='1354745585' post='1302902184']



Update T1
Set T1.CITY = T2.city
From T2
Where T1.ID = T2.ID And T2.startdate = (Select MAX(T2.startdate) From T2
Where ID = 1)

This will Work
[/quote]


nenu example ki oka record esaanu anthe... naadaggara multiple records untai...

also aggregate function filter lo raasthe work avutunda? sCo_^Y

Link to comment
Share on other sites

[quote name='deals2buy' timestamp='1354748379' post='1302902437']
nenu example ki oka record esaanu anthe... naadaggara multiple records untai...

also aggregate function filter lo raasthe work avutunda? sCo_^Y
[/quote]

may be idhi vastundi kavachhu try cheyyu

update T1
SET T1.city =T2.City
From Table1 T1
INNER JOIN
(
Select Id,
max(date),
City
From table2 group by ID)as T2
ON T1.ID=T2.ID

Link to comment
Share on other sites

[quote name='cool_dude' timestamp='1354749400' post='1302902504']

may be idhi vastundi kavachhu try cheyyu

update T1
SET T1.city =T2.City
From Table1 T1
INENR JOIN
(
Select Id,
max(date),
City
From table2 group by ID)as T2
ON T1.ID=T2.ID
[/quote]


id try ches bhayya already....error vastondi

Link to comment
Share on other sites

[quote name='cool_dude' timestamp='1354747389' post='1302902366']
SQL server babulu evarina oline lo unnara...

SSRS report lo oka issue undi...?


Daatset lo SP use chestunna in the report

So Report run chesthe time out issue vastundi in the report

Where as management studio lo SP secs lo run avtundi...

Y I am getting error in the report. Dataset refresh chesina same prob vastundi...report run chesina same prob chupistundi..Dhiniki akranam em ayyundachu..?Wt shuld I do rey
[/quote]
may be report server check chesuko...... adi oko sari high cpu lo run avtundemo........

Link to comment
Share on other sites

[quote name='deals2buy' timestamp='1354749485' post='1302902509']


id try ches bhayya already....error vastondi
[/quote]


Em error vastundi bhaiyya neeku...?

Link to comment
Share on other sites

[quote name='cool_dude' timestamp='1354749645' post='1302902521']


Em error vastundi bhaiyya neeku...?
[/quote]
Msg 147, Level 16, State 1, Line 1
An aggregate may not appear in the WHERE clause unless it is in a subquery contained in a HAVING clause or a select list, and the column being aggregated is an outer reference.

Link to comment
Share on other sites

[quote name='ghazni' timestamp='1354749565' post='1302902514']
may be report server check chesuko...... adi oko sari high cpu lo run avtundemo........
[/quote]

Inka report kuda devp cheyyaledhu bhaiyya..
naku eey problem dataset create chestunnapude vastundi....

this is wt the error I am getting

TITLE: Microsoft SQL Server Report Designer
------------------------------

An error occurred while executing the query.
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

------------------------------
ADDITIONAL INFORMATION:

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. (Microsoft SQL Server, Error: -2)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.00.4000&EvtSrc=MSSQLServer&EvtID=-2&LinkId=20476

------------------------------
BUTTONS:

OK
------------------------------

Link to comment
Share on other sites

[b] Concat Strings in SQL Server using T-SQL[/b]


Concatenating string is one of the most common tasks in SQL Server and every developer has to come across it. We have to concat the string when we have to see the display full name of the person by first name and last name. In this video we will see various methods to concatenate the strings. SQL Server 2012 has introduced new function CONCAT which concatenates the strings much efficiently.
When we concat values with ‘+’ in SQL Server we have to make sure that values are in string format. However, when we attempt to concat integer we have to convert the integers to a string or else it will throw an error. However, with the newly introduce the function of CONCAT in SQL Server 2012 we do not have to worry about this kind of issue. It concatenates strings and integers without casting or converting them. You can specify various values as a parameter to CONCAT functions and it concatenates them together.
Let us see how to concat the values in Sixty Seconds:

http://www.youtube.com/watch?feature=player_embedded&v=HbbRpg-tHz4

Here is the script which is used in the video.

[color=green]-- Method 1: Concatenating two strings[/color]
[color=blue]SELECT [/color][color=red]'FirstName' [/color][color=gray]+ [/color][color=red]' ' [/color][color=gray]+ [/color][color=red]'LastName' [/color][color=blue]AS [/color][color=black]FullName[/color]

[color=green]-- Method 2: Concatenating two Numbers[/color]
[color=blue]SELECT [/color][color=magenta]CAST[/color][color=gray]([/color][color=black]1 [/color][color=blue]AS VARCHAR[/color][color=gray]([/color][color=black]10[/color][color=gray])) + [/color][color=red]' ' [/color][color=gray]+ [/color][color=magenta]CAST[/color][color=gray]([/color][color=black]2 [/color][color=blue]AS VARCHAR[/color][color=gray]([/color][color=black]10[/color][color=gray]))[/color]

[color=green]-- Method 3: Concatenating values of table columns[/color]
[color=blue]SELECT [/color][color=black]FirstName [/color][color=gray]+ [/color][color=red]' ' [/color][color=gray]+ [/color][color=black]LastName [/color][color=blue]AS [/color][color=black]FullName[/color]
[color=blue]FROM [/color][color=black]AdventureWorks2012.Person.Person[/color]

[color=green]-- Method 4: SQL Server 2012 CONCAT function[/color]
[color=blue]SELECT [/color][color=black]CONCAT[/color][color=gray]([/color][color=red]'FirstName' [/color][color=gray], [/color][color=red]' ' [/color][color=gray], [/color][color=red]'LastName'[/color][color=gray]) [/color][color=blue]AS [/color][color=black]FullName[/color]

[color=green]-- Method 5: SQL Server 2012 CONCAT function[/color]
[color=blue]SELECT [/color][color=black]CONCAT[/color][color=gray]([/color][color=red]'FirstName' [/color][color=gray], [/color][color=red]' ' [/color][color=gray], [/color][color=black]1[/color][color=gray]) [/color][color=blue]AS [/color][color=black]FullName[/color]

Link to comment
Share on other sites

[quote name='cool_dude' timestamp='1354749744' post='1302902530']

Inka report kuda devp cheyyaledhu bhaiyya..
naku eey problem dataset create chestunnapude vastundi....

this is wt the error I am getting

TITLE: Microsoft SQL Server Report Designer
------------------------------

An error occurred while executing the query.
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

------------------------------
ADDITIONAL INFORMATION:

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. (Microsoft SQL Server, Error: -2)

For help, click: [url="http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.00.4000&EvtSrc=MSSQLServer&EvtID=-2&LinkId=20476"]http://go.microsoft....-2&LinkId=20476[/url]

------------------------------
BUTTONS:

OK
------------------------------
[/quote]
ani datasetski same vastunda leka oka danike ala avtunda......... try to prse the sp to see if it is running good.......

Link to comment
Share on other sites

×
×
  • Create New...